Break up default.nix into two more files

This commit is contained in:
kat witch 2021-08-06 04:11:06 +01:00
parent f17cb11f9f
commit 042bd05bcf
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
3 changed files with 40 additions and 36 deletions

View file

@ -2,57 +2,36 @@ let
sources = import ./nix/sources.nix;
pkgs = import ./pkgs { inherit sources; };
inherit (pkgs) lib;
sourceCache = import ./cache.nix {
inherit sources lib;
};
profiles = lib.modList {
modulesDir = ./config/profiles;
};
users = lib.modList {
modulesDir = ./config/users;
};
metaConfig = { ... }: {
config = {
runners = {
lazy = {
file = ./.;
args = [ "--show-trace" ];
};
};
_module.args = {
pkgs = lib.mkDefault pkgs;
};
};
metaConfig = import ./meta-base.nix {
inherit pkgs lib;
};
hostNames = [
"dummy"
"athame"
"beltane"
"samhain"
"yule"
# "mabon"
# "ostara"
];
eval = lib.evalModules {
modules = [
metaConfig
./config/targets
./config/modules/meta/default.nix
./config/hosts/dummy/meta.nix
./config/hosts/athame/meta.nix
./config/hosts/beltane/meta.nix
./config/hosts/samhain/meta.nix
./config/hosts/yule/meta.nix
# ./config/hosts/mabon/meta.nix
# ./config/hosts/ostara/meta.nix
];
] ++ map (hostName: ./config/hosts + "/${hostName}/meta.nix") hostNames;
specialArgs = {
inherit sources profiles users;
};
};
inherit (eval) config;
sourceCache = with lib; let
getSources = sources: removeAttrs sources [ "__functor" ]; #"dorkfiles" ];
source2drv = value: if isDerivation value.outPath then value.outPath else value;
sources2drvs = sources: mapAttrs (_: source2drv) (getSources sources);
in recurseIntoAttrs rec {
local = sources2drvs sources;
#hexchen = sources2drvs (import sources.hexchen {}).sources;
all = attrValues local; #++ attrValues hexchen;
allStr = toString all;
};
in config // { inherit pkgs sourceCache sources; }