Do this in a domain-specific way...

This commit is contained in:
niten 2024-02-01 21:00:19 -08:00
parent 62e4276a86
commit fe27dc3f3d
1 changed files with 19 additions and 19 deletions

View File

@ -10,23 +10,23 @@ in {
default = { };
};
config = let
domainName = config.instance.local-domain;
zoneName = config.fudo.domains."${domainName}".zone;
isLocal = network: hasPrefix "::1/" network || hasPrefix "127." network;
localNetworks =
filter (network: !(isLocal network)) config.instance.local-networks;
makeName = network:
if !isNull (builtins.match ":" network) then
"ip6:${network}"
else
"ip4:${network}";
netNames = map makeName localNetworks;
localNetString = concatStringsSep " " netNames;
in {
fudo.zones."${zoneName}".verbatim-dns-records = [
''@ IN TXT "v=spf1 mx ${localNetString} -all"''
''@ IN SPF "v=spf1 mx ${localNetString} -all"''
];
};
# config = let
# domainName = config.instance.local-domain;
# zoneName = config.fudo.domains."${domainName}".zone;
# isLocal = network: hasPrefix "::1/" network || hasPrefix "127." network;
# localNetworks =
# filter (network: !(isLocal network)) config.instance.local-networks;
# makeName = network:
# if !isNull (builtins.match ":" network) then
# "ip6:${network}"
# else
# "ip4:${network}";
# netNames = map makeName localNetworks;
# localNetString = concatStringsSep " " netNames;
# in {
# fudo.zones."${zoneName}".verbatim-dns-records = [
# ''@ IN TXT "v=spf1 mx ${localNetString} -all"''
# ''@ IN SPF "v=spf1 mx ${localNetString} -all"''
# ];
# };
}