2024-11-01 14:51:13 +01:00
|
|
|
inputs: let
|
2024-10-29 18:44:22 +01:00
|
|
|
inherit (inputs) self;
|
|
|
|
inherit (builtins) filter map toString;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (inputs.nixpkgs) lib;
|
|
|
|
inherit (lib.attrsets) recursiveUpdate;
|
2024-10-29 18:44:22 +01:00
|
|
|
inherit (lib.filesystem) listFilesRecursive;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib.lists) concatLists flatten singleton;
|
2024-10-29 18:44:22 +01:00
|
|
|
inherit (lib.strings) hasSuffix;
|
2025-04-09 15:31:18 +02:00
|
|
|
inherit (lib) nixosSystem;
|
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-10-29 18:44:22 +01:00
|
|
|
mkSystem = {
|
|
|
|
system,
|
|
|
|
hostname,
|
|
|
|
...
|
|
|
|
} @ args:
|
2024-11-01 14:51:13 +01:00
|
|
|
nixosSystem {
|
|
|
|
specialArgs =
|
|
|
|
recursiveUpdate
|
|
|
|
{
|
|
|
|
inherit lib;
|
|
|
|
inherit inputs;
|
|
|
|
inherit self;
|
2024-10-29 18:44:22 +01:00
|
|
|
}
|
2024-11-01 14:51:13 +01:00
|
|
|
(args.specialArgs or {});
|
|
|
|
modules = concatLists [
|
|
|
|
# This is used to pre-emptively set the hostPlatform for nixpkgs.
|
|
|
|
# Also, we set the system hostname here.
|
2024-11-06 00:11:11 +01:00
|
|
|
[
|
2025-03-03 15:43:20 +01:00
|
|
|
# self.nixosModules.user
|
2024-11-06 00:11:11 +01:00
|
|
|
]
|
2024-11-01 14:51:13 +01:00
|
|
|
(singleton {
|
2024-11-07 14:25:44 +01:00
|
|
|
networking.hostName = hostname;
|
|
|
|
nixpkgs.hostPlatform = system;
|
2024-11-01 14:51:13 +01:00
|
|
|
})
|
|
|
|
(flatten (
|
|
|
|
concatLists [
|
|
|
|
(singleton ./${hostname}/default.nix)
|
2025-03-03 15:56:59 +01:00
|
|
|
(singleton ./common.nix)
|
2024-11-01 14:51:13 +01:00
|
|
|
(
|
|
|
|
filter (hasSuffix "module.nix") (
|
|
|
|
map toString (listFilesRecursive ../modules)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
]
|
|
|
|
))
|
|
|
|
];
|
2024-08-28 18:17:55 +02:00
|
|
|
};
|
2024-11-01 14:51:13 +01:00
|
|
|
in {
|
|
|
|
temperance = mkSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
hostname = "temperance";
|
|
|
|
};
|
2024-07-21 20:14:19 +02:00
|
|
|
|
2024-11-01 14:51:13 +01:00
|
|
|
hermit = mkSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
hostname = "hermit";
|
2024-04-10 17:56:10 +02:00
|
|
|
};
|
2025-03-02 19:42:33 +01:00
|
|
|
tower = mkSystem {
|
2025-03-02 19:43:46 +01:00
|
|
|
system = "aarch64-linux";
|
2025-03-02 19:42:33 +01:00
|
|
|
hostname = "tower";
|
|
|
|
};
|
2024-04-10 17:56:53 +02:00
|
|
|
}
|