attempt 1

This commit is contained in:
jacekpoz 2024-09-01 21:09:09 +02:00
parent cb8cb2d9b3
commit dc21222846
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -5,6 +5,9 @@
inherit (inputs) self;
inherit (self) lib;
inherit (lib.attrsets) listToAttrs;
inherit (lib.path) append;
createHost' = extraModules: hostDir: lib.nixosSystem {
system = null;
specialArgs = {
@ -17,16 +20,26 @@
] ++ extraModules;
};
createHost = createHost' [];
createDesktop = createHost' [ ./common/desktop ];
createServer = createHost' [];
in {
niks = createDesktop ./niks;
del = createDesktop ./del;
hape = createDesktop ./hape;
chmura = createServer ./chmura;
${inputs.work-secrets.hostname} = createDesktop ./work;
}
createHosts = hosts: listToAttrs (map (host: let
createFn = {
desktop = createDesktop;
server = createServer;
generic = createHost;
}."${host.type}";
path' = append host.dir "system.nix";
cfg = import path';
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"; }
]