Initial commit
This commit is contained in:
commit
cfcc57a8bd
353 changed files with 18756 additions and 0 deletions
58
flake/den/modules/config.nix
Normal file
58
flake/den/modules/config.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
withSystem,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
build =
|
||||
builder: cfg:
|
||||
let
|
||||
items = map builtins.attrValues (builtins.attrValues cfg);
|
||||
buildItem = item: {
|
||||
inherit (item) name intoAttr;
|
||||
value = builder item;
|
||||
};
|
||||
in
|
||||
map buildItem (lib.flatten items);
|
||||
|
||||
osConfiguration =
|
||||
host:
|
||||
host.instantiate {
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
modules = [
|
||||
host.mainModule
|
||||
{ nixpkgs.hostPlatform = lib.mkDefault host.system; }
|
||||
];
|
||||
};
|
||||
|
||||
homeConfiguration =
|
||||
home:
|
||||
withSystem home.system (
|
||||
{ pkgs, ... }:
|
||||
home.instantiate {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
modules = [ home.mainModule ];
|
||||
}
|
||||
);
|
||||
|
||||
cfgs = (build osConfiguration config.den.hosts) ++ (build homeConfiguration config.den.homes);
|
||||
|
||||
outputs =
|
||||
acc: item:
|
||||
acc
|
||||
// {
|
||||
${item.intoAttr} = (acc.${item.intoAttr} or { }) // {
|
||||
${item.name} = item.value;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
flake = lib.foldl outputs { } cfgs;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue