mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
Break up default.nix into two more files
This commit is contained in:
parent
f17cb11f9f
commit
042bd05bcf
3 changed files with 40 additions and 36 deletions
12
cache.nix
Normal file
12
cache.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, sources }:
|
||||
|
||||
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;
|
||||
};
|
||||
51
default.nix
51
default.nix
|
|
@ -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" ];
|
||||
metaConfig = import ./meta-base.nix {
|
||||
inherit pkgs lib;
|
||||
};
|
||||
};
|
||||
_module.args = {
|
||||
pkgs = lib.mkDefault pkgs;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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; }
|
||||
|
|
|
|||
13
meta-base.nix
Normal file
13
meta-base.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, lib, ... }: {
|
||||
config = {
|
||||
runners = {
|
||||
lazy = {
|
||||
file = ./.;
|
||||
args = [ "--show-trace" ];
|
||||
};
|
||||
};
|
||||
_module.args = {
|
||||
pkgs = lib.mkDefault pkgs;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue