Refactor host entrypoints

This commit is contained in:
SebastianStork 2024-08-15 16:14:23 +02:00
parent a450e6119a
commit 13ea22656c

View file

@ -1,25 +1,23 @@
{ { inputs, self, ... }:
inputs,
self,
lib,
...
}:
let let
subdirsOf = specialArgs = {
dir: builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir dir)); inherit inputs self;
};
modulesOf = hostname: [
{ networking.hostName = hostname; }
"${self}/hosts/${hostname}"
"${self}/users/seb/@${hostname}"
];
in in
{ {
flake.nixosConfigurations = lib.genAttrs (subdirsOf "${self}/hosts") ( flake.nixosConfigurations = {
name: north = inputs.nixpkgs.lib.nixosSystem {
inputs.nixpkgs.lib.nixosSystem { inherit specialArgs;
specialArgs = { modules = modulesOf "north";
inherit inputs self; };
}; inspiron = inputs.nixpkgs.lib.nixosSystem {
modules = [ inherit specialArgs;
{ networking.hostName = name; } modules = modulesOf "inspiron";
"${self}/hosts/${name}" };
"${self}/users/seb/@${name}" };
];
}
);
} }