auto-discovered host config

This commit is contained in:
Semere Meharena Mebrahtom 2026-07-18 21:46:00 +02:00
parent edbbc0dbc2
commit 3e14a0acb8
Signed by: semere
GPG key ID: 7FC937214DF30488
4 changed files with 40 additions and 30 deletions

View file

@ -16,15 +16,20 @@
let
lib = nixpkgs.lib;
userVars = import ./vars.nix;
in
{
nixosConfigurations = {
nabro = lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit userVars; };
modules = [
./hosts/nabro/configuration.nix
hostsDir = ./hosts;
hostNames = builtins.attrNames (
lib.filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir)
);
nixosConfigurations = lib.genAttrs hostNames (name:
let
hostConfig = import (./hosts + "/${name}");
in
lib.nixosSystem {
system = hostConfig.system;
specialArgs = { inherit userVars; };
modules = [ hostConfig.configModule ] ++ [
home-manager.nixosModules.home-manager
{
home-manager = {
@ -35,7 +40,10 @@
};
}
];
};
};
}
);
in
{
inherit nixosConfigurations;
};
}