refaktoryzacja flake.nix, aby wspierał wielu hostów, a nie tylko jednego wpisanego na twardo

This commit is contained in:
2025-09-18 16:56:59 +02:00
parent 0908e9eed6
commit d01e114914
5 changed files with 49 additions and 182 deletions

View File

@@ -35,14 +35,18 @@
...
}@inputs:
let
system = "x86_64-linux";
host = "Garand-Desktop";
profile = "nvidia";
username = "garand_plg";
hostDirs = builtins.attrNames (builtins.readDir ./hosts);
# Deduplicate nixosConfigurations while preserving the top-level 'profile'
mkNixosConfig =
gpuProfile:
mkHost =
hostName:
let
inherit (import ./hosts/${hostName}/variables.nix)
host
username
profile
system
;
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
@@ -53,18 +57,12 @@
inherit system;
};
modules = [
./profiles/${gpuProfile}
./profiles/${profile}
nix-flatpak.nixosModules.nix-flatpak
];
};
in
{
nixosConfigurations = {
amd = mkNixosConfig "amd";
nvidia = mkNixosConfig "nvidia";
nvidia-laptop = mkNixosConfig "nvidia-laptop";
intel = mkNixosConfig "intel";
vm = mkNixosConfig "vm";
};
nixosConfigurations = nixpkgs.lib.genAttrs hostDirs mkHost;
};
}