pkgs/dns-slaves: DRY masterAddrs
This commit is contained in:
parent
ee0c996ddc
commit
41a7f05c50
|
@ -2,21 +2,25 @@
|
||||||
|
|
||||||
with nixpkgs.legacyPackages.${system};
|
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" (
|
writeText "named.slave.conf" (
|
||||||
lib.concatMapStringsSep "\n" ({ name, ns, ... }: ''
|
lib.concatMapStringsSep "\n" ({ name, ns, ... }: ''
|
||||||
zone "${name}" IN {
|
zone "${name}" IN {
|
||||||
type slave;
|
type slave;
|
||||||
masters {
|
masters {${mastersStr} };
|
||||||
2a00:8180:2c00:282::2;
|
|
||||||
fd23:42:c3d2:582:2::2;
|
|
||||||
172.20.73.2;
|
|
||||||
};
|
|
||||||
file "/var/lib/bind/slave/${name}.zone";
|
file "/var/lib/bind/slave/${name}.zone";
|
||||||
allow-notify {
|
allow-notify {${mastersStr} };
|
||||||
2a00:8180:2c00:282::2;
|
|
||||||
fd23:42:c3d2:582:2::2;
|
|
||||||
172.20.73.2;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
'') (
|
'') (
|
||||||
# public zones only
|
# public zones only
|
||||||
|
|
Loading…
Reference in New Issue