niksos/hosts/default.nix
jacekpoz b9e3184597
Squashed commit of the following:
commit 554a2784b4
Author: jacekpoz <jacekpoz@proton.me>
Date:   Sun Sep 1 22:28:35 2024 +0200

    make all system.nix files functions

commit dc21222846
Author: jacekpoz <jacekpoz@proton.me>
Date:   Sun Sep 1 21:09:09 2024 +0200

    attempt 1
2024-09-01 22:31:32 +02:00

47 lines
1.2 KiB
Nix

{
inputs,
...
}: let
inherit (inputs) self;
inherit (self) lib;
inherit (lib.attrsets) listToAttrs;
inherit (lib.path) append;
createHost' = extraModules: hostDir: lib.nixosSystem {
system = null;
specialArgs = {
inherit lib inputs self;
};
modules = [
hostDir
../modules
./common/core
] ++ extraModules;
};
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"; }
]