chore(access): network.networks.global

This commit is contained in:
arcnmx 2025-09-06 21:40:48 -07:00
parent 4662495775
commit dd30009b7e
5 changed files with 44 additions and 3 deletions

View file

@ -53,7 +53,10 @@
fallback =
if nameAllowed
then lib.warn "getAddressFor hostname fallback for ${config.networking.hostName} -> ${hostName}@${network}" (access.getHostnameFor hostName network)
else if forSystem.access.global.enable
then lib.warn "getAddressFor global fallback for ${config.networking.hostName} -> ${hostName}@${network}" (mkGetAddressFor true addressForAttr hostName "global")
else err;
global = forSystem.access.${addressForAttr}.global or forSystem.access.address4ForNetwork.global or fallback;
local = forSystem.access.${addressForAttr}.local or forSystem.access.address4ForNetwork.local or fallback;
int = forSystem.access.${addressForAttr}.int or forSystem.access.address4ForNetwork.int or fallback;
tail = forSystem.access.${addressForAttr}.tail or fallback;
@ -66,6 +69,8 @@
then int
else if has'Local && forSystemHas "local"
then local
else if forSystem.access.global.enable && forSystemHas "global"
then global
else fallback;
${
if has'Local
@ -85,6 +90,7 @@
else null
} =
tail;
global = global;
}
.${network}
or fallback;

View file

@ -20,6 +20,7 @@
prefix = "fd0a:";
};
int.slaac.prefix = "fd0c:";
global.domain = systemConfig.access.domain;
};
in {
options = with lib.types; {
@ -68,7 +69,7 @@
);
postfix = mkIf (config.macAddress != null) (mkOptionDefault (eui64 config.macAddress));
};
domain = mkOptionDefault "${config.name}.${systemConfig.access.domain}";
domain = mkOptionDefault knownNetworks.${config.name}.domain or "${config.name}.${systemConfig.access.domain}";
fqdn = mkOptionDefault (mapNullable (domain: "${systemConfig.access.hostName}.${domain}") config.domain);
address6 = mkIf config.slaac.enable (mkOptionDefault "${config.slaac.prefix}:${config.slaac.postfix}");
};