Auto import all hosts

This commit is contained in:
SebastianStork 2024-07-15 19:15:33 +02:00
parent ad7ae417b9
commit 8559359248
5 changed files with 26 additions and 33 deletions

25
flake/hosts.nix Normal file
View file

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