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