An overhaul of the module system.

This commit is contained in:
kat witch 2021-09-02 03:12:04 +01:00
parent 2bf9997813
commit d2a823f5bc
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
11 changed files with 181 additions and 230 deletions

View file

@ -32,13 +32,13 @@ let
If only one exists, the path for that one is returned.
Otherwise a module is generated which contains both import paths.
*/
xargNames = lib.unique (lib.folderList ./config [ "trusted" ] ++ lib.folderList ./config/trusted [ "pkgs" "tf" ]);
xarg = lib.mapListToAttrs
xargNames = lib.unique (lib.folderList ./config [ "trusted modules" ] ++ lib.folderList ./config/trusted [ "pkgs" "tf" ]);
xarg = (lib.mapListToAttrs
(folder: lib.nameValuePair folder (lib.domainMerge {
inherit folder;
folderPaths = [ (./config + "/${folder}") (./config/trusted + "/${folder}") ];
}))
xargNames;
xargNames) // { modules = lib.recursiveMod { folder = ./config/modules; inherit sources; }; };
/*
We provide the runners with this file this way. We also provide our nix args here.
@ -63,6 +63,7 @@ let
# This is where the meta config is evaluated.
eval = lib.evalModules {
modules = lib.singleton metaConfig
++ lib.singleton xarg.modules.meta
++ lib.attrValues (removeAttrs xarg.targets [ "common" ])
++ (map
(host: {
@ -70,8 +71,7 @@ let
imports = config.lib.kw.nodeImport host;
};
})
(lib.attrNames xarg.hosts))
++ lib.singleton ./config/modules/meta/default.nix;
(lib.attrNames xarg.hosts));
specialArgs = {
inherit sources root;