chore(hive.nix): Simplify system management

This commit is contained in:
Tom Hubrecht 2024-12-08 12:04:54 +01:00
parent 3a58ac3fdc
commit 3a325437b8
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc

View file

@ -6,7 +6,7 @@ let
.applyPatches' sources'; .applyPatches' sources';
nix-lib = import ./lib/nix-lib; nix-lib = import ./lib/nix-lib;
inherit (nix-lib) warn; inherit (nix-lib) mapSingleFuse;
patch = import ./lib/nix-patches { patchFile = ./patches; }; patch = import ./lib/nix-patches { patchFile = ./patches; };
@ -22,17 +22,12 @@ let
nixpkgs' = import ./meta/nixpkgs.nix; nixpkgs' = import ./meta/nixpkgs.nix;
# All supported nixpkgs versions × systems, instanciated # All supported nixpkgs versions × systems, instanciated
nixpkgs = nix-lib.mapSingleFuse ( nixpkgs = mapSingleFuse (s: mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions) nixpkgs'.systems;
s: nix-lib.mapSingleFuse (mkSystemNixpkgs s) nixpkgs'.versions
) nixpkgs'.systems;
# Get the configured nixos version for the node, # Get the configured nixos version for the node,
# defaulting to the one defined in meta/nixpkgs # defaulting to the one defined in meta/nixpkgs
version = node: nodes'.${node}.nixpkgs.version; version = node: nodes'.${node}.nixpkgs.version;
system = system = node: nodes'.${node}.nixpkgs.system;
node:
nodes'.${node}.nixpkgs.system
or (warn "${node}: Not specifying the `deployment.systemType` is deprecated!" "nixos");
nodePkgs = node: nixpkgs.${system node}.${version node}; nodePkgs = node: nixpkgs.${system node}.${version node};
@ -88,7 +83,7 @@ in
{ {
meta = { meta = {
nodeNixpkgs = nix-lib.mapSingleFuse nodePkgs nodes; nodeNixpkgs = mapSingleFuse nodePkgs nodes;
specialArgs = { specialArgs = {
inherit nixpkgs sources; inherit nixpkgs sources;
@ -96,7 +91,7 @@ in
dgn-keys = import ./keys; dgn-keys = import ./keys;
}; };
nodeSpecialArgs = nix-lib.mapSingleFuse mkArgs nodes; nodeSpecialArgs = mapSingleFuse mkArgs nodes;
}; };
registry = { registry = {
@ -140,4 +135,4 @@ in
}; };
}; };
} }
// (nix-lib.mapSingleFuse mkNode nodes) // (mapSingleFuse mkNode nodes)