1 {pkgs, lib, config, ...}:
2 let inherit (builtins) toString toPath readFile;
3 inherit (config.services) nsd;
4 serial = zone: toString (builtins.extraBuiltins.git ./. [ "log" "-1" "--format=%ct" "--" (zone + ".nix") ]);
6 serial = file: lib.removeSuffix "\n" (readFile
7 (pkgs.runCommand "zone-serial"
8 { buildInputs = [ pkgs.git ];
9 buildDepends = [ (toPath ./. + file) ];
10 preferLocalBuild = true;
11 allowSubstitutes = false;
14 ${pkgs.git}/bin/git log -1 --format="%ct" -- ${file} >$out
17 ipv4 = config.networking.zones.net.ipv4;
20 "${config.networking.domain}" = {
22 $ORIGIN ${config.networking.domain}.
25 ; SOA (Start Of Authority)
27 ${serial config.networking.domain} ; Serial number
31 1d ; TTL (Time To Live) minimum
46 ; SPF (Sender Policy Framework)
47 @ 3600 IN SPF "v=spf1 mx ip4:${ipv4} -all"
48 @ 3600 IN TXT "v=spf1 mx ip4:${ipv4} -all"
58 _git._tcp.git 18000 IN SRV 0 0 9418 git