feat: use flake-parts and auto-generate nixosConfigurations for all hosts

This commit is contained in:
transcaffeine 2025-04-02 20:12:28 +02:00
parent 4c89c45e3e
commit e9a7e56e02
Signed by: transcaffeine
GPG key ID: 03624C433676E465
3 changed files with 62 additions and 8 deletions

20
hosts/default.nix Normal file
View 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;
}