diff options
author | Alexander Ried <ried@mytum.de> | 2016-05-26 16:25:36 +0200 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2016-05-26 16:25:36 +0200 |
commit | 8fbdb40ef0ce39e6605db3dfd223402636de8907 (patch) | |
tree | 946e877fc783b56049ab9dc0be8a9e7fe46fa085 /nixos | |
parent | a2f21a54a1711ad8090ec0e4b67c0f08ffe734bc (diff) |
services.*ntp*: Add time-sync.target to ntp clients (#15714)
See: https://www.freedesktop.org/software/systemd/man/systemd.special.html#time-sync.target
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/chrony.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/networking/ntpd.nix | 2 | ||||
-rw-r--r-- | nixos/modules/services/networking/openntpd.nix | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix index 1cd678e7c621a..a38142b4a08fe 100644 --- a/nixos/modules/services/networking/chrony.nix +++ b/nixos/modules/services/networking/chrony.nix @@ -64,7 +64,7 @@ in ###### implementation - config = mkIf config.services.chrony.enable { + config = mkIf cfg.enable { # Make chronyc available in the system path environment.systemPackages = [ pkgs.chrony ]; @@ -101,12 +101,14 @@ in home = stateDir; }; - systemd.services.ntpd.enable = false; + systemd.services.ntpd.enable = mkForce false; systemd.services.chronyd = { description = "chrony NTP daemon"; wantedBy = [ "multi-user.target" ]; + wants = [ "time-sync.target" ]; + before = [ "time-sync.target" ]; after = [ "network.target" ]; conflicts = [ "ntpd.service" "systemd-timesyncd.service" ]; diff --git a/nixos/modules/services/networking/ntpd.nix b/nixos/modules/services/networking/ntpd.nix index 5256fc9bc071b..c8a0856792807 100644 --- a/nixos/modules/services/networking/ntpd.nix +++ b/nixos/modules/services/networking/ntpd.nix @@ -82,6 +82,8 @@ in { description = "NTP Daemon"; wantedBy = [ "multi-user.target" ]; + wants = [ "time-sync.target" ]; + before = [ "time-sync.target" ]; preStart = '' diff --git a/nixos/modules/services/networking/openntpd.nix b/nixos/modules/services/networking/openntpd.nix index e53fc574fbeaf..a8625fa2fa915 100644 --- a/nixos/modules/services/networking/openntpd.nix +++ b/nixos/modules/services/networking/openntpd.nix @@ -64,7 +64,8 @@ in systemd.services.openntpd = { description = "OpenNTP Server"; wantedBy = [ "multi-user.target" ]; - wants = [ "network-online.target" ]; + wants = [ "network-online.target" "time-sync.target" ]; + before = [ "time-sync.target" ]; after = [ "dnsmasq.service" "bind.service" "network-online.target" ]; serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile} ${cfg.extraOptions}"; }; |