feat: switch to automatic nixosConfiguration population

This commit is contained in:
transcaffeine 2025-04-02 20:12:28 +02:00
parent 4c89c45e3e
commit 6b8b00469e
Signed by: transcaffeine
GPG Key ID: 03624C433676E465
2 changed files with 25 additions and 8 deletions

View File

@ -4,14 +4,10 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs @ { self, nixpkgs, ... }: {
nixosConfigurations.backstage = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/backstage
];
specialArgs = { inherit inputs; };
};
outputs = inputs @ { self, nixpkgs, ... }: {
imports = [
./hosts
];
};
}

21
hosts/default.nix Normal file
View File

@ -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);
}