diff options
Diffstat (limited to 'config/dns.nix')
-rw-r--r-- | config/dns.nix | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/config/dns.nix b/config/dns.nix index 9f05807..a7de636 100644 --- a/config/dns.nix +++ b/config/dns.nix @@ -1,26 +1,29 @@ # dnssec-signzone -A -3 $(head -c 1000 /dev/urandom | sha1sum | cut -b 1-16) -N unixtime -o $zone -t db.${zone} { config, lib, pkgs, ... }: let - zones = pkgs.callPackage ../pkgs/zone-files/default.nix { }; + masterZones = [ "orbekk.com" "orbekk.no" "kufieta.net" ]; + zone-files = pkgs.callPackage ../pkgs/zone-files/default.nix { }; in { services.bind = { enable = true; extraConfig = '' - zone orbekk.com { - type master; - file "/var/run/named/db.orbekk.com.zone"; - auto-dnssec maintain; - key-directory "/opt/secret/bind/orbekk.com"; - update-policy local; - allow-query { any; }; - }; + ${concatMapStrings (zone: '' + zone orbekk.com { + type master; + file "/var/run/named/db.${zone}.zone"; + auto-dnssec maintain; + key-directory "/opt/secret/bind/${zone}"; + update-policy local; + allow-query { any; }; + }; + '') masterZones} ''; }; systemd.services.bind = { preStart = lib.mkAfter '' - cp -f ${zones}/* /var/run/named/ + cp -f ${zone-files}/* /var/run/named/ ''; }; } |