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;
|
2024-09-08 20:35:33 +02:00
|
|
|
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.
|
|
|
|
|
2024-09-08 20:35:33 +02:00
|
|
|
mkModulesFor = hostname:
|
|
|
|
flatten (
|
|
|
|
concatLists [
|
|
|
|
# Derive host specific module path from the first argument of the
|
|
|
|
# function. Should be a string, obviously.
|
2024-09-09 11:11:53 +02:00
|
|
|
(singleton ./${hostname}/default.nix)
|
2024-09-08 20:35:33 +02:00
|
|
|
|
|
|
|
# Recursively import all module trees (i.e. directories with a `module.nix`)
|
2024-09-09 11:11:53 +02:00
|
|
|
# for given moduleTree directories
|
2024-09-08 20:35:33 +02:00
|
|
|
(mkModuleTree' {path = ../modules;})
|
|
|
|
]
|
|
|
|
);
|
2024-04-10 17:56:10 +02:00
|
|
|
in {
|
2024-08-28 18:17:55 +02:00
|
|
|
flake.nixosConfigurations = {
|
|
|
|
temperance = mkSystem {
|
|
|
|
inherit withSystem;
|
|
|
|
system = "x86_64-linux";
|
2024-09-08 20:35:33 +02:00
|
|
|
modules = mkModulesFor "temperance";
|
2024-08-28 18:17:55 +02:00
|
|
|
};
|
2024-07-21 20:14:19 +02:00
|
|
|
|
2024-08-28 18:17:55 +02:00
|
|
|
hermit = mkSystem {
|
|
|
|
inherit withSystem;
|
|
|
|
system = "x86_64-linux";
|
2024-09-08 20:35:33 +02:00
|
|
|
modules = mkModulesFor "hermit";
|
2024-08-28 18:17:55 +02:00
|
|
|
};
|
2024-04-10 17:56:10 +02:00
|
|
|
};
|
2024-04-10 17:56:53 +02:00
|
|
|
}
|