use mapAttrs to define hosts

This commit is contained in:
Peder Bergebakken Sundt 2024-01-11 15:06:19 +01:00
parent b3d24c9b2f
commit b8d72b4078
1 changed files with 12 additions and 12 deletions

View File

@ -121,7 +121,7 @@
#"riscv64-linux" #"riscv64-linux"
]; ];
mkModule = hostname: domain: system: inputs: stateVersion: modules: ({ lib, ... }: { mkModule = domain: system: inputs: stateVersion: modules: hostname: ({ lib, ... }: {
system.stateVersion = lib.mkDefault stateVersion; # TODO: home-manager system.stateVersion = lib.mkDefault stateVersion; # TODO: home-manager
imports = [ imports = [
@ -175,13 +175,13 @@
"nixpkgs-git=github:NixOS/nixpkgs/nixos-unstable-small" "nixpkgs-git=github:NixOS/nixpkgs/nixos-unstable-small"
]; ];
}); });
mkConfig = hostname: domain: system: inputs: stateVersion: modules: inputs.nixpkgs.lib.nixosSystem { mkConfig = domain: system: inputs: stateVersion: modules: hostname: inputs.nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
flakes = mkFlakeView inputs system; flakes = mkFlakeView inputs system;
}; };
modules = [ (mkModule hostname domain system inputs stateVersion modules) ]; modules = [ (mkModule domain system inputs stateVersion modules hostname) ];
}; };
mkHosts = mk: let mkHosts = mk: let
ls = imports: { inherit imports; }; ls = imports: { inherit imports; };
@ -194,15 +194,15 @@
rocm = ls [ ./hardware/gpu/rocm.nix hw.common-gpu-amd ]; rocm = ls [ ./hardware/gpu/rocm.nix hw.common-gpu-amd ];
hidpi = hw.common-hidpi; hidpi = hw.common-hidpi;
p1005 = ./hardware/printer/hp-laserjet-p1005.nix; p1005 = ./hardware/printer/hp-laserjet-p1005.nix;
in { in builtins.mapAttrs (hostname: curried: curried hostname) {
#attrpath "hostname" "domain" "system" inputs "state" [ modules ... ] #hostname "domain" "system" inputs "state" [ modules ... ]
noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" inputs-2311 "22.11" [ intel ]; noximilien = mk "pbsds.net" "x86_64-linux" inputs-2311 "22.11" [ intel ];
brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ amd ]; brumlebasse = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ amd ];
nord = mk "nord" "pbsds.net" "x86_64-linux" inputs-2305 "22.11" [ intel-novga hw.common-cpu-intel-sandy-bridge rocm hidpi ]; nord = mk "pbsds.net" "x86_64-linux" inputs-2305 "22.11" [ intel-novga hw.common-cpu-intel-sandy-bridge rocm hidpi ];
sopp = mk "sopp" "pbsds.net" "x86_64-linux" inputs-2305 "23.05" [ intel cuda p1005 ]; sopp = mk "pbsds.net" "x86_64-linux" inputs-2305 "23.05" [ intel cuda p1005 ];
bolle = mk "bolle" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel ]; bolle = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel ];
eple = mk "eple" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel ]; eple = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel ];
garp = mk "garp" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel-novga cuda ]; garp = mk "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ intel-novga cuda ];
#gomperud smattkuken skrytebiffen skalkesnerken balleby brumlebasse bingus skjrlaltatjlstad #gomperud smattkuken skrytebiffen skalkesnerken balleby brumlebasse bingus skjrlaltatjlstad
#bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke eple hasselknippe pytte uddu imdorf rosenqvist #bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke eple hasselknippe pytte uddu imdorf rosenqvist
}; };