git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #89773 from rnhmjoj/ncdns

ncdns: init at 0.0.10.3

commitfc553c0bc5411478e2448a707f74369ae9351e96 authorMichele Guerini Rocco <rnhmjoj@users.noreply.github.com> dateTue 7 Jul 2020, 10:58 (6 years ago) parent01c4a388ff681a
8 files changed+736
nixos/modules/module-list.nix+1 nixos/modules/services/networking/ncdns.nix+278 nixos/tests/all-tests.nix+1 nixos/tests/ncdns.nix+77 pkgs/servers/dns/ncdns/default.nix+41 pkgs/servers/dns/ncdns/deps.nix+309 pkgs/servers/dns/ncdns/fix-tpl-path.nix+27 pkgs/top-level/all-packages.nix+2
nixos/modules/module-list.nix+1
@@ -607,6 +607,7 @@
607607 ./services/networking/dnscrypt-wrapper.nix
608608 ./services/networking/dnsdist.nix
609609 ./services/networking/dnsmasq.nix
610+ ./services/networking/ncdns.nix
610611 ./services/networking/ejabberd.nix
611612 ./services/networking/epmd.nix
612613 ./services/networking/ergo.nix
nixos/modules/services/networking/ncdns.nixnew file+278
@@ -0,0 +1,278 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfgs = config.services;
7+ cfg = cfgs.ncdns;
8+
9+ dataDir = "/var/lib/ncdns";
10+ username = "ncdns";
11+
12+ valueType = with types; oneOf [ int str bool path ]
13+ // { description = "setting type (integer, string, bool or path)"; };
14+
15+ configType = with types; attrsOf (nullOr (either valueType configType))
16+ // { description = ''
17+ ncdns.conf configuration type. The format consists of an
18+ attribute set of settings. Each setting can be either `null`,
19+ a value or an attribute set. The allowed values are integers,
20+ strings, booleans or paths.
21+ '';
22+ };
23+
24+ configFile = pkgs.runCommand "ncdns.conf"
25+ { json = builtins.toJSON cfg.settings;
26+ passAsFile = [ "json" ];
27+ }
28+ "${pkgs.remarshal}/bin/json2toml < $jsonPath > $out";
29+
30+ defaultFiles = {
31+ public = "${dataDir}/bit.key";
32+ private = "${dataDir}/bit.private";
33+ zonePublic = "${dataDir}/bit-zone.key";
34+ zonePrivate = "${dataDir}/bit-zone.private";
35+ };
36+
37+ # if all keys are the default value
38+ needsKeygen = all id (flip mapAttrsToList cfg.dnssec.keys
39+ (n: v: v == getAttr n defaultFiles));
40+
41+ mkDefaultAttrs = mapAttrs (n: v: mkDefault v);
42+
43+in
44+
45+{
46+
47+ ###### interface
48+
49+ options = {
50+
51+ services.ncdns = {
52+
53+ enable = mkEnableOption ''
54+ ncdns, a Go daemon to bridge Namecoin to DNS.
55+ To resolve .bit domains set <literal>services.namecoind.enable = true;</literal>
56+ and an RPC username/password
57+ '';
58+
59+ address = mkOption {
60+ type = types.str;
61+ default = "127.0.0.1";
62+ description = ''
63+ The IP address the ncdns resolver will bind to. Leave this unchanged
64+ if you do not wish to directly expose the resolver.
65+ '';
66+ };
67+
68+ port = mkOption {
69+ type = types.port;
70+ default = 5333;
71+ description = ''
72+ The port the ncdns resolver will bind to.
73+ '';
74+ };
75+
76+ identity.hostname = mkOption {
77+ type = types.str;
78+ default = config.networking.hostName;
79+ example = "example.com";
80+ description = ''
81+ The hostname of this ncdns instance, which defaults to the machine
82+ hostname. If specified, ncdns lists the hostname as an NS record at
83+ the zone apex:
84+ <programlisting>
85+ bit. IN NS ns1.example.com.
86+ </programlisting>
87+ If unset ncdns will generate an internal psuedo-hostname under the
88+ zone, which will resolve to the value of
89+ <option>services.ncdns.identity.address</option>.
90+ If you are only using ncdns locally you can ignore this.
91+ '';
92+ };
93+
94+ identity.hostmaster = mkOption {
95+ type = types.str;
96+ default = "";
97+ example = "root@example.com";
98+ description = ''
99+ An email address for the SOA record at the bit zone.
100+ If you are only using ncdns locally you can ignore this.
101+ '';
102+ };
103+
104+ identity.address = mkOption {
105+ type = types.str;
106+ default = "127.127.127.127";
107+ description = ''
108+ The IP address the hostname specified in
109+ <option>services.ncdns.identity.hostname</option> should resolve to.
110+ If you are only using ncdns locally you can ignore this.
111+ '';
112+ };
113+
114+ dnssec.enable = mkEnableOption ''
115+ DNSSEC support in ncdns. This will generate KSK and ZSK keypairs
116+ (unless provided via the options
117+ <option>services.ncdns.dnssec.publicKey</option>,
118+ <option>services.ncdns.dnssec.privateKey</option> etc.) and add a trust
119+ anchor to recursive resolvers
120+ '';
121+
122+ dnssec.keys.public = mkOption {
123+ type = types.path;
124+ default = defaultFiles.public;
125+ description = ''
126+ Path to the file containing the KSK public key.
127+ The key can be generated using the <literal>dnssec-keygen</literal>
128+ command, provided by the package <package>bind</package> as follows:
129+ <programlisting>
130+ $ dnssec-keygen -a RSASHA256 -3 -b 2048 -f KSK bit
131+ </programlisting>
132+ '';
133+ };
134+
135+ dnssec.keys.private = mkOption {
136+ type = types.path;
137+ default = defaultFiles.private;
138+ description = ''
139+ Path to the file containing the KSK private key.
140+ '';
141+ };
142+
143+ dnssec.keys.zonePublic = mkOption {
144+ type = types.path;
145+ default = defaultFiles.zonePublic;
146+ description = ''
147+ Path to the file containing the ZSK public key.
148+ The key can be generated using the <literal>dnssec-keygen</literal>
149+ command, provided by the package <package>bind</package> as follows:
150+ <programlisting>
151+ $ dnssec-keygen -a RSASHA256 -3 -b 2048 bit
152+ </programlisting>
153+ '';
154+ };
155+
156+ dnssec.keys.zonePrivate = mkOption {
157+ type = types.path;
158+ default = defaultFiles.zonePrivate;
159+ description = ''
160+ Path to the file containing the ZSK private key.
161+ '';
162+ };
163+
164+ settings = mkOption {
165+ type = configType;
166+ default = { };
167+ example = literalExample ''
168+ { # enable webserver
169+ ncdns.httplistenaddr = ":8202";
170+
171+ # synchronize TLS certs
172+ certstore.nss = true;
173+ # note: all paths are relative to the config file
174+ certstore.nsscertdir = "../../var/lib/ncdns";
175+ certstore.nssdbdir = "../../home/alice/.pki/nssdb";
176+ }
177+ '';
178+ description = ''
179+ ncdns settings. Use this option to configure ncds
180+ settings not exposed in a NixOS option or to bypass one.
181+ See the example ncdns.conf file at <link xlink:href="
182+ https://git.io/JfX7g"/> for the available options.
183+ '';
184+ };
185+
186+ };
187+
188+ services.pdns-recursor.resolveNamecoin = mkOption {
189+ type = types.bool;
190+ default = false;
191+ description = ''
192+ Resolve <literal>.bit</literal> top-level domains using ncdns and namecoin.
193+ '';
194+ };
195+
196+ };
197+
198+
199+ ###### implementation
200+
201+ config = mkIf cfg.enable {
202+
203+ services.pdns-recursor = mkIf cfgs.pdns-recursor.resolveNamecoin {
204+ forwardZonesRecurse.bit = "127.0.0.1:${toString cfg.port}";
205+ luaConfig =
206+ if cfg.dnssec.enable
207+ then ''readTrustAnchorsFromFile("${cfg.dnssec.keys.public}")''
208+ else ''addNTA("bit", "namecoin DNSSEC disabled")'';
209+ };
210+
211+ # Avoid pdns-recursor not finding the DNSSEC keys
212+ systemd.services.pdns-recursor = mkIf cfgs.pdns-recursor.resolveNamecoin {
213+ after = [ "ncdns.service" ];
214+ wants = [ "ncdns.service" ];
215+ };
216+
217+ services.ncdns.settings = mkDefaultAttrs {
218+ ncdns =
219+ { # Namecoin RPC
220+ namecoinrpcaddress =
221+ "${cfgs.namecoind.rpc.address}:${toString cfgs.namecoind.rpc.port}";
222+ namecoinrpcusername = cfgs.namecoind.rpc.user;
223+ namecoinrpcpassword = cfgs.namecoind.rpc.password;
224+
225+ # Identity
226+ selfname = cfg.identity.hostname;
227+ hostmaster = cfg.identity.hostmaster;
228+ selfip = cfg.identity.address;
229+
230+ # Other
231+ bind = "${cfg.address}:${toString cfg.port}";
232+ }
233+ // optionalAttrs cfg.dnssec.enable
234+ { # DNSSEC
235+ publickey = "../.." + cfg.dnssec.keys.public;
236+ privatekey = "../.." + cfg.dnssec.keys.private;
237+ zonepublickey = "../.." + cfg.dnssec.keys.zonePublic;
238+ zoneprivatekey = "../.." + cfg.dnssec.keys.zonePrivate;
239+ };
240+
241+ # Daemon
242+ service.daemon = true;
243+ xlog.journal = true;
244+ };
245+
246+ users.users.ncdns =
247+ { description = "ncdns daemon user"; };
248+
249+ systemd.services.ncdns = {
250+ description = "ncdns daemon";
251+ after = [ "namecoind.service" ];
252+ wantedBy = [ "multi-user.target" ];
253+
254+ serviceConfig = {
255+ User = "ncdns";
256+ StateDirectory = "ncdns";
257+ Restart = "on-failure";
258+ ExecStart = "${pkgs.ncdns}/bin/ncdns -conf=${configFile}";
259+ };
260+
261+ preStart = optionalString (cfg.dnssec.enable && needsKeygen) ''
262+ cd ${dataDir}
263+ if [ ! -e bit.key ]; then
264+ ${pkgs.bind}/bin/dnssec-keygen -a RSASHA256 -3 -b 2048 bit
265+ mv Kbit.*.key bit-zone.key
266+ mv Kbit.*.private bit-zone.private
267+ ${pkgs.bind}/bin/dnssec-keygen -a RSASHA256 -3 -b 2048 -f KSK bit
268+ mv Kbit.*.key bit.key
269+ mv Kbit.*.private bit.private
270+ fi
271+ '';
272+ };
273+
274+ };
275+
276+ meta.maintainers = with lib.maintainers; [ rnhmjoj ];
277+
278+}
nixos/tests/all-tests.nix+1
@@ -221,6 +221,7 @@ in
221221 nat.firewall = handleTest ./nat.nix { withFirewall = true; };
222222 nat.firewall-conntrack = handleTest ./nat.nix { withFirewall = true; withConntrackHelpers = true; };
223223 nat.standalone = handleTest ./nat.nix { withFirewall = false; };
224+ ncdns = handleTest ./ncdns.nix {};
224225 ndppd = handleTest ./ndppd.nix {};
225226 neo4j = handleTest ./neo4j.nix {};
226227 specialisation = handleTest ./specialisation.nix {};
nixos/tests/ncdns.nixnew file+77
@@ -0,0 +1,77 @@
1+import ./make-test-python.nix ({ pkgs, ... }:
2+let
3+ fakeReply = pkgs.writeText "namecoin-reply.json" ''
4+ { "error": null,
5+ "id": 1,
6+ "result": {
7+ "address": "T31q8ucJ4dI1xzhxQ5QispfECld5c7Xw",
8+ "expired": false,
9+ "expires_in": 2248,
10+ "height": 438155,
11+ "name": "d/test",
12+ "txid": "db61c0b2540ba0c1a2c8cc92af703a37002e7566ecea4dbf8727c7191421edfb",
13+ "value": "{\"ip\": \"1.2.3.4\", \"email\": \"root@test.bit\",\"info\": \"Fake record\"}",
14+ "vout": 0
15+ }
16+ }
17+ '';
18+in
19+
20+{
21+ name = "ncdns";
22+
23+ nodes.server = { ... }: {
24+ networking.nameservers = [ "127.0.0.1" ];
25+
26+ services.namecoind.rpc = {
27+ address = "127.0.0.1";
28+ user = "namecoin";
29+ password = "secret";
30+ port = 8332;
31+ };
32+
33+ # Fake namecoin RPC server because we can't
34+ # run a full node in a test.
35+ systemd.services.namecoind = {
36+ wantedBy = [ "multi-user.target" ];
37+ script = ''
38+ while true; do
39+ echo -e "HTTP/1.1 200 OK\n\n $(<${fakeReply})\n" \
40+ | ${pkgs.netcat}/bin/nc -N -l 127.0.0.1 8332
41+ done
42+ '';
43+ };
44+
45+ services.ncdns = {
46+ enable = true;
47+ dnssec.enable = true;
48+ };
49+
50+ services.pdns-recursor = {
51+ enable = true;
52+ dns.allowFrom = [ "127.0.0.0/8" ];
53+ settings.loglevel = 8;
54+ resolveNamecoin = true;
55+ };
56+
57+ environment.systemPackages = [ pkgs.dnsutils ];
58+
59+ };
60+
61+ testScript = ''
62+ with subtest("DNSSEC keys have been generated"):
63+ server.wait_for_unit("ncdns")
64+ server.wait_for_file("/var/lib/ncdns/bit.key")
65+ server.wait_for_file("/var/lib/ncdns/bit-zone.key")
66+
67+ with subtest("DNSKEY bit record is present"):
68+ server.wait_for_unit("pdns-recursor")
69+ server.wait_for_open_port("53")
70+ server.succeed("host -t DNSKEY bit")
71+
72+ with subtest("can resolve a .bit name"):
73+ server.wait_for_unit("namecoind")
74+ server.wait_for_open_port("8332")
75+ assert "1.2.3.4" in server.succeed("host -t A test.bit")
76+ '';
77+})
pkgs/servers/dns/ncdns/default.nixnew file+41
@@ -0,0 +1,41 @@
1+{ lib, nixosTests, git, buildGoPackage, fetchFromGitHub, libcap }:
2+
3+buildGoPackage rec {
4+ pname = "ncdns";
5+ version = "0.0.10.3";
6+
7+ goPackagePath = "github.com/namecoin/ncdns";
8+ goDeps = ./deps.nix;
9+
10+ src = fetchFromGitHub {
11+ owner = "namecoin";
12+ repo = "ncdns";
13+ rev = "v${version}";
14+ sha256 = "12q5al48mkjhgyk7z5wyklzzrdbcqhwxl79axa4gh9ld75prghbq";
15+ };
16+
17+ patches = [ ./fix-tpl-path.nix ];
18+
19+ buildInputs = [ libcap ];
20+
21+ preBuild = ''
22+ go generate github.com/namecoin/x509-signature-splice/...
23+ '';
24+
25+ postInstall = ''
26+ mkdir -p "$out/share"
27+ cp -r "$src/_doc" "$out/share/doc"
28+ cp -r "$src/_tpl" "$out/share/tpl"
29+ '';
30+
31+ meta = with lib; {
32+ description = "Namecoin to DNS bridge daemon";
33+ homepage = "https://github.com/namecoin/ncdns";
34+ license = licenses.gpl3Plus;
35+ platforms = platforms.all;
36+ maintainers = with maintainers; [ rnhmjoj ];
37+ };
38+
39+ passthru.tests.ncdns = nixosTests.ncdns;
40+
41+}
pkgs/servers/dns/ncdns/deps.nixnew file+309
@@ -0,0 +1,309 @@
1+# This file was generated by https://github.com/kamilchm/go2nix v1.3.0
2+[
3+ {
4+ goPackagePath = "github.com/BurntSushi/toml";
5+ fetch = {
6+ type = "git";
7+ url = "https://github.com/BurntSushi/toml";
8+ rev = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005";
9+ sha256 = "1fjdwwfzyzllgiwydknf1pwjvy49qxfsczqx5gz3y0izs7as99j6";
10+ };
11+ }
12+ {
13+ goPackagePath = "github.com/alecthomas/template";
14+ fetch = {
15+ type = "git";
16+ url = "https://github.com/alecthomas/template";
17+ rev = "fb15b899a75114aa79cc930e33c46b577cc664b1";
18+ sha256 = "1vlasv4dgycydh5wx6jdcvz40zdv90zz1h7836z7lhsi2ymvii26";
19+ };
20+ }
21+ {
22+ goPackagePath = "github.com/alecthomas/units";
23+ fetch = {
24+ type = "git";
25+ url = "https://github.com/alecthomas/units";
26+ rev = "f65c72e2690dc4b403c8bd637baf4611cd4c069b";
27+ sha256 = "04jyqm7m3m01ppfy1f9xk4qvrwvs78q9zml6llyf2b3v5k6b2bbc";
28+ };
29+ }
30+ {
31+ goPackagePath = "github.com/btcsuite/btcd";
32+ fetch = {
33+ type = "git";
34+ url = "https://github.com/btcsuite/btcd";
35+ rev = "9f0179fd2c46caba343b6515602cf37172f14d5f";
36+ sha256 = "0cvpjsxlyzm04pwzi7nj43k9h5wfxj07jdc49qxsav5323v1nvka";
37+ };
38+ }
39+ {
40+ goPackagePath = "github.com/btcsuite/btclog";
41+ fetch = {
42+ type = "git";
43+ url = "https://github.com/btcsuite/btclog";
44+ rev = "84c8d2346e9fc8c7b947e243b9c24e6df9fd206a";
45+ sha256 = "02dl46wcnfpg9sqvg0ipipkpnd7lrf4fnvb9zy56jqa7mfcwc7wk";
46+ };
47+ }
48+ {
49+ goPackagePath = "github.com/btcsuite/btcutil";
50+ fetch = {
51+ type = "git";
52+ url = "https://github.com/btcsuite/btcutil";
53+ rev = "b2bf7f89d674a3702182b7e15f52807896051af3";
54+ sha256 = "0wwykb4cbq8xj2mls2mxma5vaahdgdy3vqw1r2fi4wyj0yr4kyw9";
55+ };
56+ }
57+ {
58+ goPackagePath = "github.com/btcsuite/go-socks";
59+ fetch = {
60+ type = "git";
61+ url = "https://github.com/btcsuite/go-socks";
62+ rev = "4720035b7bfd2a9bb130b1c184f8bbe41b6f0d0f";
63+ sha256 = "18cv2icj059lq4s99p6yh91hlas5f2gi3f1p4c10sjgwrs933d7b";
64+ };
65+ }
66+ {
67+ goPackagePath = "github.com/btcsuite/websocket";
68+ fetch = {
69+ type = "git";
70+ url = "https://github.com/btcsuite/websocket";
71+ rev = "31079b6807923eb23992c421b114992b95131b55";
72+ sha256 = "0xpkf257ml6fpfdgv7hxxc41n0d5yxxm3njm50qpzp7j71l9cjwa";
73+ };
74+ }
75+ {
76+ goPackagePath = "github.com/coreos/go-systemd";
77+ fetch = {
78+ type = "git";
79+ url = "https://github.com/coreos/go-systemd";
80+ rev = "b51e752dd1c9c618846f8bc5b95ab524bd7b11c2";
81+ sha256 = "127dj1iwp69yj74nwh9ckgc0mkk1mv4yzbxmbdxix1r7j6q35z3j";
82+ };
83+ }
84+ {
85+ goPackagePath = "github.com/golang/groupcache";
86+ fetch = {
87+ type = "git";
88+ url = "https://github.com/golang/groupcache";
89+ rev = "8c9f03a8e57eb486e42badaed3fb287da51807ba";
90+ sha256 = "0vjjr79r32icjzlb05wn02k59av7jx0rn1jijml8r4whlg7dnkfh";
91+ };
92+ }
93+ {
94+ goPackagePath = "github.com/hlandau/buildinfo";
95+ fetch = {
96+ type = "git";
97+ url = "https://github.com/hlandau/buildinfo";
98+ rev = "337a29b5499734e584d4630ce535af64c5fe7813";
99+ sha256 = "1kq3r1i4rr9bcvj5yg8w1l95f6sfc3kn6kgcdmlh5i3j9w2sram8";
100+ };
101+ }
102+ {
103+ goPackagePath = "github.com/hlandau/degoutils";
104+ fetch = {
105+ type = "git";
106+ url = "https://github.com/hlandau/degoutils";
107+ rev = "8fa2440b63444dad556d76366f1c3ee070c8a577";
108+ sha256 = "1yj39jbrk3xx3cyl8f4asakc74lsl0brasi25xjf6219pg69q0iy";
109+ };
110+ }
111+ {
112+ goPackagePath = "github.com/hlandau/dexlogconfig";
113+ fetch = {
114+ type = "git";
115+ url = "https://github.com/hlandau/dexlogconfig";
116+ rev = "244f29bd260884993b176cd14ef2f7631f6f3c18";
117+ sha256 = "1d01ghx6xawj3nk3lpk51wbbpxdnc9vzvijvlayvp7cxgsacslbc";
118+ };
119+ }
120+ {
121+ goPackagePath = "github.com/hlandau/xlog";
122+ fetch = {
123+ type = "git";
124+ url = "https://github.com/hlandau/xlog";
125+ rev = "197ef798aed28e08ed3e176e678fda81be993a31";
126+ sha256 = "08rjlqnjbfgpz5rbjq89l7y5vyhk99ivr928sqdi5gnqznbqs4m8";
127+ };
128+ }
129+ {
130+ goPackagePath = "github.com/kr/pretty";
131+ fetch = {
132+ type = "git";
133+ url = "https://github.com/kr/pretty";
134+ rev = "4e0886370c3a67530192c6a238cff68f56c141b0";
135+ sha256 = "1ywbfzz1h3a3qd8rpkiqwi1dm4w8ls9ijb4x1b7567grns9f0vnp";
136+ };
137+ }
138+ {
139+ goPackagePath = "github.com/kr/text";
140+ fetch = {
141+ type = "git";
142+ url = "https://github.com/kr/text";
143+ rev = "702c74938df48b97370179f33ce2107bd7ff3b3e";
144+ sha256 = "0hf58ypz6rxsw6nx3i856whir9lvy4sdx946wbw1nfaf2rdmr9vx";
145+ };
146+ }
147+ {
148+ goPackagePath = "github.com/mattn/go-isatty";
149+ fetch = {
150+ type = "git";
151+ url = "https://github.com/mattn/go-isatty";
152+ rev = "cb30d6282491c185f77d9bec5d25de1bb61a06bc";
153+ sha256 = "0v59mv94acd2m72q8adhigxkx1vn38l5h0d8hp0nxga2v9f3v8kd";
154+ };
155+ }
156+ {
157+ goPackagePath = "github.com/miekg/dns";
158+ fetch = {
159+ type = "git";
160+ url = "https://github.com/miekg/dns";
161+ rev = "203ad2480beb9330454efc215d21f16c607e8174";
162+ sha256 = "12i2l79whv7a8c27f1dvq4wqikx4d0l30r1ja68zfgrgik6vryxq";
163+ };
164+ }
165+ {
166+ goPackagePath = "github.com/namecoin/btcd";
167+ fetch = {
168+ type = "git";
169+ url = "https://github.com/namecoin/btcd";
170+ rev = "69a10543311fa68737d0a77b4cd045b0b0abfb75";
171+ sha256 = "1zbfigs3hrjhdwp19877lpgivdcz3k80149nxdmxlmp03xcswcqy";
172+ };
173+ }
174+ {
175+ goPackagePath = "github.com/namecoin/ncbtcjson";
176+ fetch = {
177+ type = "git";
178+ url = "https://github.com/namecoin/ncbtcjson";
179+ rev = "fa221af062c70f802db6ed66e1546cc4a41ec277";
180+ sha256 = "1fmz5aylsji27vj5f3f3gg9xj99735gh5prvcfz0gmk68v1mnr4i";
181+ };
182+ }
183+ {
184+ goPackagePath = "github.com/namecoin/ncrpcclient";
185+ fetch = {
186+ type = "git";
187+ url = "https://github.com/namecoin/ncrpcclient";
188+ rev = "858e1a5acd8b2da56462f50323633cdf2fe80977";
189+ sha256 = "0pj951wm6fdkk2yv4bxaxka52i7rb6w3fs9ah3fy7p8wchr4smjx";
190+ };
191+ }
192+ {
193+ goPackagePath = "github.com/namecoin/tlsrestrictnss";
194+ fetch = {
195+ type = "git";
196+ url = "https://github.com/namecoin/tlsrestrictnss";
197+ rev = "945a9f3d995fcb175fd0b19549e21a3e87ba8c13";
198+ sha256 = "18qphkqnjw3bwflkyyrddyzgwscs37j7y6ynm9g78bqb5skviqqy";
199+ };
200+ }
201+ {
202+ goPackagePath = "github.com/namecoin/x509-signature-splice";
203+ fetch = {
204+ type = "git";
205+ url = "https://github.com/namecoin/x509-signature-splice";
206+ rev = "d8b4bf2df701c55239a9fe82bb1e7bea10e30599";
207+ sha256 = "0jlj4gb60s7b69d8yx6ljhxgvqgjz01n0h59fswblw09wfba8c4j";
208+ };
209+ }
210+ {
211+ goPackagePath = "github.com/ogier/pflag";
212+ fetch = {
213+ type = "git";
214+ url = "https://github.com/ogier/pflag";
215+ rev = "45c278ab3607870051a2ea9040bb85fcb8557481";
216+ sha256 = "0620v75wppfd84d95n312wpngcb73cph4q3ivs1h0waljfnsrd5l";
217+ };
218+ }
219+ {
220+ goPackagePath = "github.com/shiena/ansicolor";
221+ fetch = {
222+ type = "git";
223+ url = "https://github.com/shiena/ansicolor";
224+ rev = "a422bbe96644373c5753384a59d678f7d261ff10";
225+ sha256 = "1dcn8a9z6a5dxa2m3fkppnajcls8lanbl38qggkf646yi5qsk1hc";
226+ };
227+ }
228+ {
229+ goPackagePath = "golang.org/x/crypto";
230+ fetch = {
231+ type = "git";
232+ url = "https://go.googlesource.com/crypto";
233+ rev = "279210d13fedf5be6d476bad5df6a015042bb905";
234+ sha256 = "0syi72jba84nn1z89bqpcv94wjvzj71dwg1pj30xrcixcz1zsg26";
235+ };
236+ }
237+ {
238+ goPackagePath = "golang.org/x/net";
239+ fetch = {
240+ type = "git";
241+ url = "https://go.googlesource.com/net";
242+ rev = "627f9648deb96c27737b83199d44bb5c1010cbcf";
243+ sha256 = "0ziz7i9mhz6dy2f58dsa83flkk165w1cnazm7yksql5i9m7x099z";
244+ };
245+ }
246+ {
247+ goPackagePath = "golang.org/x/sys";
248+ fetch = {
249+ type = "git";
250+ url = "https://go.googlesource.com/sys";
251+ rev = "6fdc65e7d9800cc59998e8ac0d9406a20ff5f399";
252+ sha256 = "0al5gzij4qkrp11i1h8j7288pg6y716zyh2v0886pv2knha7gjvj";
253+ };
254+ }
255+ {
256+ goPackagePath = "gopkg.in/alecthomas/kingpin.v2";
257+ fetch = {
258+ type = "git";
259+ url = "https://gopkg.in/alecthomas/kingpin.v2";
260+ rev = "947dcec5ba9c011838740e680966fd7087a71d0d";
261+ sha256 = "0mndnv3hdngr3bxp7yxfd47cas4prv98sqw534mx7vp38gd88n5r";
262+ };
263+ }
264+ {
265+ goPackagePath = "gopkg.in/hlandau/configurable.v1";
266+ fetch = {
267+ type = "git";
268+ url = "https://gopkg.in/hlandau/configurable.v1";
269+ rev = "41496864a1fe3e0fef2973f22372b755d2897402";
270+ sha256 = "0i9jbdvi8rz12xsrzzbfxg5lwsqakjcmccsa5a32asmv26k5byqa";
271+ };
272+ }
273+ {
274+ goPackagePath = "gopkg.in/hlandau/easyconfig.v1";
275+ fetch = {
276+ type = "git";
277+ url = "https://gopkg.in/hlandau/easyconfig.v1";
278+ rev = "c31249162931b4963bbe6e501cccb60d23271a3f";
279+ sha256 = "1v8j1pyzcfj1l4pmb1c6mszci6xzc4agdam2kq79kyvbsvbbw9dc";
280+ };
281+ }
282+ {
283+ goPackagePath = "gopkg.in/hlandau/madns.v2";
284+ fetch = {
285+ type = "git";
286+ url = "https://gopkg.in/hlandau/madns.v2";
287+ rev = "26979b3e4b5aa3e0bd53cf0a014f9eaf43b578e3";
288+ sha256 = "09r4m4mqdgd7hvxyvss9m64lq0kk8nylnq2bgnkrclgzpi87fmmb";
289+ };
290+ }
291+ {
292+ goPackagePath = "gopkg.in/hlandau/service.v2";
293+ fetch = {
294+ type = "git";
295+ url = "https://gopkg.in/hlandau/service.v2";
296+ rev = "b64b3467ebd16f64faec1640c25e318efc0c0d7b";
297+ sha256 = "0lpx88f46ylx9lf6jgwcjgklll1pc1mlakrywpa0wzhjj7a4jinc";
298+ };
299+ }
300+ {
301+ goPackagePath = "gopkg.in/hlandau/svcutils.v1";
302+ fetch = {
303+ type = "git";
304+ url = "https://gopkg.in/hlandau/svcutils.v1";
305+ rev = "c25dac49e50cbbcbef8c81b089f56156f4067729";
306+ sha256 = "12b6p71mk33r44d71xizjq82fls0ykfwfl5gnmckbgpxms4bj2xf";
307+ };
308+ }
309+]
pkgs/servers/dns/ncdns/fix-tpl-path.nixnew file+27
@@ -0,0 +1,27 @@
1+This sets a default value for the tpl directory that works for Nixpkgs.
2+
3+diff --git a/server/web.go b/server/web.go
4+index d024a42..0522d02 100644
5+--- a/server/web.go
6++++ b/server/web.go
7+@@ -10,6 +10,7 @@ import "path/filepath"
8+ import "time"
9+ import "strings"
10+ import "fmt"
11++import "os"
12+
13+ var layoutTpl *template.Template
14+ var mainPageTpl *template.Template
15+@@ -44,7 +45,11 @@ func deriveTemplate(filename string) (*template.Template, error) {
16+ }
17+
18+ func (s *Server) tplFilename(filename string) string {
19+- td := filepath.Join(s.cfg.ConfigDir, "..", "tpl")
20++ ex, err := os.Executable()
21++ if err != nil {
22++ panic(err)
23++ }
24++ td := filepath.Join(filepath.Dir(ex), "..", "share", "tpl")
25+ if s.cfg.TplPath != "" {
26+ td = s.cfg.TplPath
27+ }
pkgs/top-level/all-packages.nix+2
@@ -16012,6 +16012,8 @@ in
1601216012
1601316013 unit = callPackage ../servers/http/unit { };
1601416014
16015+ ncdns = callPackage ../servers/dns/ncdns { };
16016+
1601516017 nginx = nginxStable;
1601616018
1601716019 nginxStable = callPackage ../servers/http/nginx/stable.nix {