feat: switch to automatic nixosConfiguration population
This commit is contained in:
parent
4c89c45e3e
commit
6b8b00469e
12
flake.nix
12
flake.nix
|
@ -4,14 +4,10 @@
|
||||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ { self, nixpkgs, ... }: {
|
outputs = inputs @ { self, nixpkgs, ... }: {
|
||||||
nixosConfigurations.backstage = nixpkgs.lib.nixosSystem {
|
imports = [
|
||||||
system = "x86_64-linux";
|
./hosts
|
||||||
modules = [
|
];
|
||||||
./hosts/backstage
|
|
||||||
];
|
|
||||||
specialArgs = { inherit inputs; };
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{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: {
|
||||||
|
imports = [
|
||||||
|
(./. + "/${name}")
|
||||||
|
];
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
nixosConfigurations = lib.map (host: lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = host;
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
}) (builtins.attrValues hosts);
|
||||||
|
}
|
Loading…
Reference in New Issue