]> Git — Sourcephile - sourcephile-nix.git/blob - install/logical/friot/nsd/commonade.coop.nix
update
[sourcephile-nix.git] / install / logical / friot / nsd / commonade.coop.nix
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") ]);
5 /*
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;
12 } ''
13 cd ${toPath ./.}
14 ${pkgs.git}/bin/git log -1 --format="%ct" -- ${file} >$out
15 ''));
16 */
17 ipv4 = config.networking.zones.net.ipv4;
18 domain = "commonade.coop";
19 in
20 {
21 "${domain}" = {
22 data = ''
23 $ORIGIN ${domain}.
24 $TTL 86400
25
26 ; SOA (Start Of Authority)
27 @ SOA ns admin (
28 ${serial domain} ; Serial number
29 1d ; Refresh
30 15m ; Retry
31 2592000 ; Expire
32 1d ; TTL (Time To Live) minimum
33 )
34
35 ; A (DNS -> IPv4)
36 @ A ${ipv4}
37 autoconfig A ${ipv4}
38 git A ${ipv4}
39 imap A ${ipv4}
40 mail A ${ipv4}
41 ns A ${ipv4}
42 pop A ${ipv4}
43 smtp A ${ipv4}
44 submission A ${ipv4}
45 www A ${ipv4}
46
47 ; SPF (Sender Policy Framework)
48 @ 3600 IN SPF "v=spf1 mx ip4:${ipv4} -all"
49 @ 3600 IN TXT "v=spf1 mx ip4:${ipv4} -all"
50
51 ; NS (Name Server)
52 @ NS ns
53 ;@ NS ns6.gandi.net.
54
55 ; MX (Mail eXchange)
56 @ 180 MX 5 ${ipv4}
57
58 ; SRV (SeRVice)
59 _git._tcp.git 18000 IN SRV 0 0 9418 git
60 '';
61 };
62 }