refactor(flake): split host guest and module assembly

This commit is contained in:
2026-08-28 22:45:47 -04:00
parent b3c2cedf2b
commit 9366a90bca
18 changed files with 470 additions and 561 deletions

49
flake/host.nix Normal file
View File

@@ -0,0 +1,49 @@
{
inputs,
lib,
specialArgs,
repositoryModules,
guestModules,
# TODO refactor registry
registryAssembly,
}:
let
mkHost =
{
root,
name,
}:
lib.nixosSystem {
inherit specialArgs;
modules = [
inputs.chaotic.nixosModules.default
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
inputs.stylix.nixosModules.stylix
repositoryModules
guestModules
# TODO: refactor
registryAssembly.module (root + "/${name}")
{
networking.hostName = name;
modules.host.enable = true;
}
];
};
in
{
mkHosts =
{ root }:
let
directories = lib.filterAttrs (_name: type: type == "directory") (builtins.readDir root);
names = lib.attrNames directories;
in
lib.genAttrs names (
name:
mkHost { inherit root name; }
);
}