git.iko.soy/typeable/nixpkgs
on master help sign in
services.*ntp*: Add time-sync.target to ntp clients (#15714)

See: https://www.freedesktop.org/software/systemd/man/systemd.special.html#time-sync.target

commit8fbdb40ef0ce39e6605db3dfd223402636de8907 authorAlexander Ried <ried@mytum.de> dateThu 26 May 2016, 16:25 (11 years ago) parenta2f21a5
3 files changed+8−3
nixos/modules/services/networking/chrony.nix+4−2 nixos/modules/services/networking/ntpd.nix+2 nixos/modules/services/networking/openntpd.nix+2−1
nixos/modules/services/networking/chrony.nix+4−2
@@ -64,7 +64,7 @@ in
6464
6565 ###### implementation
6666
67− config = mkIf config.services.chrony.enable {
67+ config = mkIf cfg.enable {
6868
6969 # Make chronyc available in the system path
7070 environment.systemPackages = [ pkgs.chrony ];
@@ -101,12 +101,14 @@ in
101101 home = stateDir;
102102 };
103103
104− systemd.services.ntpd.enable = false;
104+ systemd.services.ntpd.enable = mkForce false;
105105
106106 systemd.services.chronyd =
107107 { description = "chrony NTP daemon";
108108
109109 wantedBy = [ "multi-user.target" ];
110+ wants = [ "time-sync.target" ];
111+ before = [ "time-sync.target" ];
110112 after = [ "network.target" ];
111113 conflicts = [ "ntpd.service" "systemd-timesyncd.service" ];
112114
nixos/modules/services/networking/ntpd.nix+2
@@ -82,6 +82,8 @@ in
8282 { description = "NTP Daemon";
8383
8484 wantedBy = [ "multi-user.target" ];
85+ wants = [ "time-sync.target" ];
86+ before = [ "time-sync.target" ];
8587
8688 preStart =
8789 ''
nixos/modules/services/networking/openntpd.nix+2−1
@@ -64,7 +64,8 @@ in
6464 systemd.services.openntpd = {
6565 description = "OpenNTP Server";
6666 wantedBy = [ "multi-user.target" ];
67− wants = [ "network-online.target" ];
67+ wants = [ "network-online.target" "time-sync.target" ];
68+ before = [ "time-sync.target" ];
6869 after = [ "dnsmasq.service" "bind.service" "network-online.target" ];
6970 serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile} ${cfg.extraOptions}";
7071 };