mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
lib: allow to import JSON and TOML files
The vision here is that configuration tools can generate .json or .toml files, which can be plugged into an existing configuration. Eg: { lib, ... }: { imports = [ (lib.modules.importJSON ./hardware-configuration.json) ]; }
This commit is contained in:
parent
947a7d33f9
commit
035627dff2
@ -869,4 +869,21 @@ rec {
|
||||
];
|
||||
};
|
||||
|
||||
/* Use this function to import a JSON file as NixOS configuration.
|
||||
|
||||
importJSON -> path -> attrs
|
||||
*/
|
||||
importJSON = file: {
|
||||
_file = file;
|
||||
config = lib.importJSON file;
|
||||
};
|
||||
|
||||
/* Use this function to import a TOML file as NixOS configuration.
|
||||
|
||||
importTOML -> path -> attrs
|
||||
*/
|
||||
importTOML = file: {
|
||||
_file = file;
|
||||
config = lib.importTOML file;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user