about summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2020-10-09 17:07:51 +0000
committerGitHub <noreply@github.com>2020-10-09 17:07:51 +0000
commitd8e4c8e612b05e00b7ead45d57547e4d24a3dc65 (patch)
tree914da1008841e2fbad81b7b092b80b8a63126192 /lib/modules.nix
parent73155864faf6c9b00e6e1b58d913bd3980bdf0a1 (diff)
parent035627dff23c4524345c4013e5e01ca95597452b (diff)
downloadnixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar.gz
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar.bz2
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar.lz
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar.xz
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.tar.zst
nixlib-d8e4c8e612b05e00b7ead45d57547e4d24a3dc65.zip
Merge pull request #96641 from zimbatm/data-module-imports
nixos: Data module imports
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 02a669df6593..df3a2ad17e5f 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -875,4 +875,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;
+  };
 }