feat(infra): Add nodeMeta argument

This commit is contained in:
Tom Hubrecht 2024-04-18 15:53:20 +02:00
parent f63c95e4d9
commit cbdbed1099
4 changed files with 12 additions and 11 deletions

View file

@ -49,6 +49,8 @@ let
}; };
meta = (import ./meta) lib; meta = (import ./meta) lib;
nodeMeta = meta.nodes.${node};
}; };
in in
@ -64,7 +66,7 @@ in
}; };
defaults = defaults =
{ meta, name, ... }: { name, nodeMeta, ... }:
{ {
# Import the default modules # Import the default modules
imports = [ ./modules ]; imports = [ ./modules ];
@ -73,7 +75,7 @@ in
age-secrets.sources = [ (./machines + "/${name}/secrets") ]; age-secrets.sources = [ (./machines + "/${name}/secrets") ];
# Deployment config is specified in meta.nodes.${node}.deployment # Deployment config is specified in meta.nodes.${node}.deployment
inherit (meta.nodes.${name}) deployment; inherit (nodeMeta) deployment;
nix = { nix = {
# Set NIX_PATH to the patched version of nixpkgs # Set NIX_PATH to the patched version of nixpkgs
@ -92,7 +94,7 @@ in
# Use the stateVersion declared in the metadata # Use the stateVersion declared in the metadata
system = { system = {
inherit (meta.nodes.${name}) stateVersion; inherit (nodeMeta) stateVersion;
}; };
}; };
} }

View file

@ -35,7 +35,7 @@
config, config,
lib, lib,
meta, meta,
name, nodeMeta,
... ...
}: }:
@ -49,7 +49,6 @@ let
types types
; ;
nodeMeta = meta.nodes.${name};
admins = admins =
meta.organization.groups.root meta.organization.groups.root
++ nodeMeta.admins ++ nodeMeta.admins

View file

@ -1,8 +1,7 @@
{ {
config, config,
meta,
name,
lib, lib,
nodeMeta,
... ...
}: }:
let let
@ -24,13 +23,13 @@ in
register = true; register = true;
update_all = true; update_all = true;
virtual = { virtual = {
enabled = meta.nodes.${name}.vm-cluster != null; enabled = nodeMeta.vm-cluster != null;
cluster_name = meta.nodes.${name}.vm-cluster; cluster_name = nodeMeta.vm-cluster;
}; };
purge_old_devices = true; purge_old_devices = true;
hostname_cmd = "echo ${hostName}.${domain}"; hostname_cmd = "echo ${hostName}.${domain}";
datacenter_location = { datacenter_location = {
driver = "cmd:echo ${meta.nodes.${name}.site}"; driver = "cmd:echo ${nodeMeta.site}";
regex = "(.*)"; regex = "(.*)";
}; };
device = { device = {

View file

@ -3,6 +3,7 @@
lib, lib,
meta, meta,
name, name,
nodeMeta,
... ...
}: }:
@ -42,7 +43,7 @@ in
inherit (net') hostId; inherit (net') hostId;
hostName = name; hostName = name;
domain = "${meta.nodes.${name}.site}.infra.dgnum.eu"; domain = "${nodeMeta.site}.infra.dgnum.eu";
useNetworkd = true; useNetworkd = true;
firewall.logRefusedConnections = false; firewall.logRefusedConnections = false;