summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2017-10-12 22:33:17 -0400
committerJoerg Thalheim <joerg@thalheim.io>2017-10-13 10:29:12 +0100
commitbbec429f7a22ee7b7aaf17be3e4d52c89d924cf2 (patch)
treec00af4d94e02db76d9138bef9fbfcc63dc19121e /nixos
parent6ec6af462573c07cab55dd56ec8e05f7b3dd719b (diff)
downloadnixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar.gz
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar.bz2
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar.lz
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar.xz
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.tar.zst
nixpkgs-bbec429f7a22ee7b7aaf17be3e4d52c89d924cf2.zip
djbdns: fix root server list at build time
as suggested by @peterhoeg in
https://github.com/NixOS/nixpkgs/commit/1b7e5eaa79241080eac2a0b79883a17c9e5f4731#commitcomment-24560631

fixes #30379
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/dnscache.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/dnscache.nix b/nixos/modules/services/networking/dnscache.nix
index f782be97f6f..379203cd1ab 100644
--- a/nixos/modules/services/networking/dnscache.nix
+++ b/nixos/modules/services/networking/dnscache.nix
@@ -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
   '';