fix(dgn-network): Clarify variables and add dns settings from metadata

This commit is contained in:
Tom Hubrecht 2024-02-20 17:47:34 +01:00
parent 000e35bb68
commit e7f4d76dc1

View file

@ -14,7 +14,7 @@ let
optionalAttrs optionalAttrs
; ;
net = meta.network.${name}; net' = meta.network.${name};
mkAddress = { address, prefixLength, ... }: "${address}/${builtins.toString prefixLength}"; mkAddress = { address, prefixLength, ... }: "${address}/${builtins.toString prefixLength}";
mkRoute = gateway: { mkRoute = gateway: {
@ -41,7 +41,7 @@ let
"2001:4860:4860::8888#dns.google" "2001:4860:4860::8888#dns.google"
"2606:4700:4700::1001#cloudflare-dns.com" "2606:4700:4700::1001#cloudflare-dns.com"
"2001:4860:4860::8844#dns.google" "2001:4860:4860::8844#dns.google"
]; ] ++ (net'.dns or [ ]);
networkConfig = optionalAttrs (net ? DHCP) { inherit (net) DHCP; }; networkConfig = optionalAttrs (net ? DHCP) { inherit (net) DHCP; };
}; };
@ -56,7 +56,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking = { networking = {
inherit (net) hostId; inherit (net') hostId;
hostName = name; hostName = name;
domain = "${meta.nodes.${name}.zone}.infra.dgnum.eu"; domain = "${meta.nodes.${name}.zone}.infra.dgnum.eu";
@ -65,6 +65,6 @@ in
firewall.logRefusedConnections = false; firewall.logRefusedConnections = false;
}; };
systemd.network.networks = mapAttrs' mkInterface net.interfaces; systemd.network.networks = mapAttrs' mkInterface net'.interfaces;
}; };
} }