nichts/hosts/default.nix

41 lines
1.1 KiB
Nix
Raw Normal View History

2024-07-21 20:14:19 +02:00
{
withSystem,
2024-08-30 23:15:56 +02:00
inputs,
2024-07-21 20:14:19 +02:00
...
}: let
2024-08-30 23:15:56 +02:00
inherit (inputs.self) lib;
inherit (lib.extendedLib.builders) mkSystem;
inherit (lib.extendedLib.modules) mkModuleTree';
inherit (lib.lists) concatLists flatten singleton;
2024-09-08 21:09:17 +02:00
# NOTE: This was inspired by raf, and I find this
# to be quite a sane way of managing all modules in my flake.
mkModulesFor = hostname:
flatten (
concatLists [
# Derive host specific module path from the first argument of the
# function. Should be a string, obviously.
2024-09-08 21:09:17 +02:00
(singleton ./cr/${hostname}/default.nix)
# Recursively import all module trees (i.e. directories with a `module.nix`)
# for given moduleTree directories, and in addition, roles.
(mkModuleTree' {path = ../modules;})
]
);
2024-04-10 17:56:10 +02:00
in {
flake.nixosConfigurations = {
temperance = mkSystem {
inherit withSystem;
system = "x86_64-linux";
modules = mkModulesFor "temperance";
};
2024-07-21 20:14:19 +02:00
hermit = mkSystem {
inherit withSystem;
system = "x86_64-linux";
modules = mkModulesFor "hermit";
};
2024-04-10 17:56:10 +02:00
};
2024-04-10 17:56:53 +02:00
}