1
0
Fork 0
This commit is contained in:
Lukas Wurzinger 2025-07-14 00:12:47 +02:00
parent 56c97b3712
commit 3f6dafe073
No known key found for this signature in database
13 changed files with 65 additions and 90 deletions

View file

@ -98,10 +98,52 @@
};
};
flake = {
lib = nixpkgs.lib.extend (import ./lib.nix);
flake.nixosConfigurations =
let
inherit (nixpkgs) lib;
nixosConfigurations = self.lib.genNixosConfigurations inputs;
};
findModules =
paths:
builtins.concatMap (
path:
lib.pipe path [
(lib.fileset.fileFilter (file: file.hasExt "nix"))
lib.fileset.toList
]
) paths;
genNixosConfigurations =
inputs:
let
modulesDir = ./modules;
profilesDir = ./profiles;
commonDir = ./common;
hostsDir = ./hosts;
commonNixosSystem =
name:
lib.nixosSystem {
specialArgs = {
inherit inputs lib;
attrName = name;
};
modules = findModules [
modulesDir
profilesDir
commonDir
(hostsDir + /${name})
];
};
hosts = lib.pipe hostsDir [
builtins.readDir
(lib.filterAttrs (_: type: type == "directory"))
builtins.attrNames
];
in
lib.genAttrs hosts commonNixosSystem;
in
genNixosConfigurations inputs;
};
}