2025-12-01 13:23:24 +07:00
|
|
|
{
|
|
|
|
|
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 {
|
2025-12-06 01:00:44 +07:00
|
|
|
specialArgs = { inherit inputs; };
|
2025-12-01 13:23:24 +07:00
|
|
|
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;
|
|
|
|
|
}
|