3
0
Fork 0
forked from mirrors/nixpkgs

services.*ntp*: Add time-sync.target to ntp clients (#15714)

See: https://www.freedesktop.org/software/systemd/man/systemd.special.html#time-sync.target
This commit is contained in:
Alexander Ried 2016-05-26 16:25:36 +02:00 committed by Franz Pletz
parent a2f21a54a1
commit 8fbdb40ef0
3 changed files with 8 additions and 3 deletions

View file

@ -64,7 +64,7 @@ in
###### implementation ###### implementation
config = mkIf config.services.chrony.enable { config = mkIf cfg.enable {
# Make chronyc available in the system path # Make chronyc available in the system path
environment.systemPackages = [ pkgs.chrony ]; environment.systemPackages = [ pkgs.chrony ];
@ -101,12 +101,14 @@ in
home = stateDir; home = stateDir;
}; };
systemd.services.ntpd.enable = false; systemd.services.ntpd.enable = mkForce false;
systemd.services.chronyd = systemd.services.chronyd =
{ description = "chrony NTP daemon"; { description = "chrony NTP daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "time-sync.target" ];
before = [ "time-sync.target" ];
after = [ "network.target" ]; after = [ "network.target" ];
conflicts = [ "ntpd.service" "systemd-timesyncd.service" ]; conflicts = [ "ntpd.service" "systemd-timesyncd.service" ];

View file

@ -82,6 +82,8 @@ in
{ description = "NTP Daemon"; { description = "NTP Daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
wants = [ "time-sync.target" ];
before = [ "time-sync.target" ];
preStart = preStart =
'' ''

View file

@ -64,7 +64,8 @@ in
systemd.services.openntpd = { systemd.services.openntpd = {
description = "OpenNTP Server"; description = "OpenNTP Server";
wantedBy = [ "multi-user.target" ]; 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" ]; after = [ "dnsmasq.service" "bind.service" "network-online.target" ];
serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile} ${cfg.extraOptions}"; serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile} ${cfg.extraOptions}";
}; };