niksos/hosts/default.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

{
2023-07-13 12:49:20 +02:00
inputs,
...
}: let
2023-09-08 16:10:15 +02:00
inherit (inputs) self;
2024-03-19 00:04:33 +01:00
inherit (self) lib;
2024-03-08 15:12:45 +01:00
inherit (lib.attrsets) listToAttrs;
inherit (lib.path) append;
createHost' = extraModules: hostDir: lib.nixosSystem {
system = null;
specialArgs = {
inherit lib inputs self;
};
2024-02-19 17:06:47 +01:00
modules = [
2024-08-30 20:29:16 +02:00
hostDir
2024-02-19 17:06:47 +01:00
../modules
./common/core
] ++ extraModules;
2024-02-19 17:06:47 +01:00
};
createHost = createHost' [];
createDesktop = createHost' [ ./common/desktop ];
createServer = createHost' [];
createHosts = hosts: listToAttrs (map (host: let
createFn = {
desktop = createDesktop;
server = createServer;
generic = createHost;
}."${host.type}";
path' = append host.dir "system.nix";
cfg = (import path') {
inherit inputs;
};
in {
name = cfg.poz.other.system.hostname;
value = createFn host.dir;
}) hosts);
in createHosts [
{ dir = ./niks; type = "desktop"; }
{ dir = ./del; type = "desktop"; }
{ dir = ./hape; type = "desktop"; }
{ dir = ./chmura; type = "server"; }
{ dir = ./work; type = "desktop"; }
]