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