From 93aa285376daea647df6d95c50622230d118fd01 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Tue, 23 Oct 2018 15:49:42 -0500 Subject: [PATCH] nixos: fix #48917 by setting SYSTEMD_TIMEDATED_NTP_SERVICES Setting this variable in the environment of systemd-timedated allows 'timedatectl' to tell if an NTP service is running. Closes #48917. Signed-off-by: Austin Seipp --- nixos/modules/services/networking/chrony.nix | 2 ++ nixos/modules/services/networking/ntpd.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix index a363b545d64..9b8005e706a 100644 --- a/nixos/modules/services/networking/chrony.nix +++ b/nixos/modules/services/networking/chrony.nix @@ -93,6 +93,8 @@ in services.timesyncd.enable = mkForce false; + systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; }; + systemd.services.chronyd = { description = "chrony NTP daemon"; diff --git a/nixos/modules/services/networking/ntpd.nix b/nixos/modules/services/networking/ntpd.nix index 342350d49ab..32174100b0f 100644 --- a/nixos/modules/services/networking/ntpd.nix +++ b/nixos/modules/services/networking/ntpd.nix @@ -67,6 +67,8 @@ in environment.systemPackages = [ pkgs.ntp ]; services.timesyncd.enable = mkForce false; + systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "ntpd.service"; }; + users.users = singleton { name = ntpUser; uid = config.ids.uids.ntp;