pkgs/dns-slaves: DRY masterAddrs
This commit is contained in:
parent
ee0c996ddc
commit
41a7f05c50
|
@ -2,21 +2,25 @@
|
|||
|
||||
with nixpkgs.legacyPackages.${system};
|
||||
|
||||
let
|
||||
servConf = self.lib.config.site.net.serv;
|
||||
masterAddrs =
|
||||
[servConf.hosts4.dns] ++
|
||||
map (hosts6: hosts6.dns)
|
||||
(builtins.attrValues servConf.hosts6);
|
||||
mastersStr =
|
||||
builtins.foldl' (result: addr:
|
||||
"${result} ${addr};"
|
||||
) "" masterAddrs;
|
||||
in
|
||||
|
||||
writeText "named.slave.conf" (
|
||||
lib.concatMapStringsSep "\n" ({ name, ns, ... }: ''
|
||||
zone "${name}" IN {
|
||||
type slave;
|
||||
masters {
|
||||
2a00:8180:2c00:282::2;
|
||||
fd23:42:c3d2:582:2::2;
|
||||
172.20.73.2;
|
||||
};
|
||||
masters {${mastersStr} };
|
||||
file "/var/lib/bind/slave/${name}.zone";
|
||||
allow-notify {
|
||||
2a00:8180:2c00:282::2;
|
||||
fd23:42:c3d2:582:2::2;
|
||||
172.20.73.2;
|
||||
};
|
||||
allow-notify {${mastersStr} };
|
||||
};
|
||||
'') (
|
||||
# public zones only
|
||||
|
|
Loading…
Reference in New Issue