Skip to content

Commit

Permalink
djbdns: fix root server list at build time
Browse files Browse the repository at this point in the history
  • Loading branch information
jerith666 authored and Mic92 committed Oct 13, 2017
1 parent 6ec6af4 commit bbec429
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions nixos/modules/services/networking/dnscache.nix
Expand Up @@ -18,10 +18,13 @@ let
'') ips}
'') cfg.domainServers)}
# djbdns contains an outdated list of root servers;
# if one was not provided in config, provide a current list
if [ ! -e servers/@ ]; then
awk '/^.?.ROOT-SERVERS.NET/ { print $4 }' ${pkgs.dns-root-data}/root.hints > $out/servers/@
# if a list of root servers was not provided in config, copy it
# over. (this is also done by dnscache-conf, but we 'rm -rf
# /var/lib/dnscache/root' below & replace it wholesale with this,
# so we have to ensure servers/@ exists ourselves.)
if [ ! -e $out/servers/@ ]; then
# symlink does not work here, due chroot
cp ${pkgs.djbdns}/etc/dnsroots.global $out/servers/@;
fi
'';

Expand Down
4 changes: 3 additions & 1 deletion pkgs/tools/networking/djbdns/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, glibc } :
{ stdenv, fetchurl, glibc, dns-root-data } :

let
version = "1.05";
Expand All @@ -23,6 +23,8 @@ stdenv.mkDerivation {
postPatch = ''
echo gcc -O2 -include ${glibc.dev}/include/errno.h > conf-cc
echo $out > conf-home
# djbdns ships with an outdated list of root servers
awk '/^.?.ROOT-SERVERS.NET/ { print $4 }' ${dns-root-data}/root.hints > dnsroots.global
sed -i "s|/etc/dnsroots.global|$out/etc/dnsroots.global|" dnscache-conf.c
'';

Expand Down

0 comments on commit bbec429

Please sign in to comment.