feat: use flake-parts and auto-generate nixosConfigurations for all hosts
This commit is contained in:
parent
4c89c45e3e
commit
e9a7e56e02
3 changed files with 62 additions and 8 deletions
20
hosts/default.nix
Normal file
20
hosts/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{inputs, self, ...}:
|
||||
let
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
isDirectory = _name: type: type == "directory";
|
||||
hostNames = builtins.attrNames (
|
||||
lib.filterAttrs isDirectory (builtins.readDir ./.)
|
||||
);
|
||||
hosts = lib.genAttrs hostNames (name: {
|
||||
modules = [
|
||||
(./. + "/${name}")
|
||||
];
|
||||
});
|
||||
in
|
||||
{
|
||||
flake.nixosConfigurations = lib.mapAttrs (host: hostConfig: lib.nixosSystem {
|
||||
inherit (hostConfig) modules;
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
}) hosts;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue