Fix ntpd

Since the 4.2.8 upgrade, ntpd is broken on NixOS:

Dec 28 19:06:54 hagbard ntpd[27723]: giving up resolving host 1.nixos.pool.ntp.org: Servname not supported for ai_socktype (-8)

This appears to be because DNS resolution doesn't work in chroots
anymore (due to /etc being missing). So disable chroots for now. It's
probably better to use systemd's containment facilities anyway.

+7 -11
+7 -11
nixos/modules/services/networking/ntpd.nix
··· 11 ntpUser = "ntp"; 12 13 configFile = pkgs.writeText "ntp.conf" '' 14 - # Keep the drift file in ${stateDir}/ntp.drift. However, since we 15 - # chroot to ${stateDir}, we have to specify it as /ntp.drift. 16 - driftfile /ntp.drift 17 18 - restrict default kod nomodify notrap nopeer noquery 19 - restrict -6 default kod nomodify notrap nopeer noquery 20 restrict 127.0.0.1 21 restrict -6 ::1 22 23 ${toString (map (server: "server " + server + " iburst\n") config.services.ntp.servers)} 24 ''; 25 26 - ntpFlags = "-c ${configFile} -u ${ntpUser}:nogroup -i ${stateDir}"; 27 28 in 29 ··· 64 65 config = mkIf config.services.ntp.enable { 66 67 - # Make tools such as ntpq available in the system path 68 environment.systemPackages = [ pkgs.ntp ]; 69 70 users.extraUsers = singleton ··· 74 home = stateDir; 75 }; 76 77 - jobs.ntpd = 78 { description = "NTP Daemon"; 79 80 wantedBy = [ "multi-user.target" ]; 81 82 - path = [ ntp ]; 83 - 84 preStart = 85 '' 86 mkdir -m 0755 -p ${stateDir} 87 chown ${ntpUser} ${stateDir} 88 ''; 89 90 - exec = "ntpd -g -n ${ntpFlags}"; 91 }; 92 93 };
··· 11 ntpUser = "ntp"; 12 13 configFile = pkgs.writeText "ntp.conf" '' 14 + driftfile ${stateDir}/ntp.drift 15 16 restrict 127.0.0.1 17 restrict -6 ::1 18 19 ${toString (map (server: "server " + server + " iburst\n") config.services.ntp.servers)} 20 ''; 21 22 + ntpFlags = "-c ${configFile} -u ${ntpUser}:nogroup"; 23 24 in 25 ··· 60 61 config = mkIf config.services.ntp.enable { 62 63 + # Make tools such as ntpq available in the system path. 64 environment.systemPackages = [ pkgs.ntp ]; 65 66 users.extraUsers = singleton ··· 70 home = stateDir; 71 }; 72 73 + systemd.services.ntpd = 74 { description = "NTP Daemon"; 75 76 wantedBy = [ "multi-user.target" ]; 77 78 preStart = 79 '' 80 mkdir -m 0755 -p ${stateDir} 81 chown ${ntpUser} ${stateDir} 82 ''; 83 84 + serviceConfig = { 85 + ExecStart = "@${ntp}/bin/ntpd ntpd -g -n ${ntpFlags}"; 86 + }; 87 }; 88 89 };