cleanup
This commit is contained in:
parent
56c97b3712
commit
3f6dafe073
13 changed files with 65 additions and 90 deletions
50
flake.nix
50
flake.nix
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue