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)
      ];
    }
wip/yesman
zimbatm 4 years ago
parent 947a7d33f9
commit 035627dff2
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7
  1. 17
      lib/modules.nix

@ -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…
Cancel
Save