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

View file

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

View file

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

View file

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