diff --git a/lib.nix b/lib.nix index cd3ca17..41c5ac5 100644 --- a/lib.nix +++ b/lib.nix @@ -37,9 +37,19 @@ let attrNames (filterAttrs (_: hostOpts: hostOpts.domain == domain) entities.hosts); - getSiteGateway = site: entities.sites."${site-name}".gateway-v4; + getSiteGatewayV4 = siteName: + let site = config.fudo.sites."${siteName}"; + in if hasAttr "local-gateway" site then getHostIpv4 else site.gateway-v4; - getHostGateway = hostname: (getHostSite hostname).gateway-v4; + getHostGatewayV4 = hostname: + getSiteGatewayV4 config.fudo.hosts."${hostname}".site; + + getSiteGatewayV6 = siteName: + let site = config.fudo.sites."${siteName}"; + in if hasAttr "local-gateway" site then getHostIpv6 else site.gateway-v6; + + getHostGatewayV6 = hostname: + getSiteGatewayV6 config.fudo.hosts."${hostname}".site; in { inherit getHostSite getHostDomain getHostRealm getHostFqdn getHostIpv4