From b8d72b4078c2bbad7d5ac9cce8a790450d9f0c4d Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Thu, 11 Jan 2024 15:06:19 +0100 Subject: [PATCH] use mapAttrs to define hosts --- flake.nix | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index f5a6b59..cc85621 100644 --- a/flake.nix +++ b/flake.nix @@ -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 };