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