From 615db90f3db73ebe5bef1bab3f1fca90a6cbe521 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Fri, 17 Sep 2021 12:00:00 +0000 Subject: [PATCH] nixos/openntpd, nixos/ntp: define group, fix after #133166 --- nixos/modules/misc/ids.nix | 2 +- nixos/modules/services/networking/ntp/ntpd.nix | 12 ++++++------ nixos/modules/services/networking/ntp/openntpd.nix | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 79e0d774d272..30a9e5cf6ed9 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -212,7 +212,7 @@ in sddm = 175; tss = 176; #memcached = 177; removed 2018-01-03 - ntp = 179; + #ntp = 179; # dynamically allocated as of 2021-09-17 zabbix = 180; #redis = 181; removed 2018-01-03 #unifi = 183; dynamically allocated as of 2021-09-17 diff --git a/nixos/modules/services/networking/ntp/ntpd.nix b/nixos/modules/services/networking/ntp/ntpd.nix index 861b0db01a48..1dffbd78bbe4 100644 --- a/nixos/modules/services/networking/ntp/ntpd.nix +++ b/nixos/modules/services/networking/ntp/ntpd.nix @@ -10,8 +10,6 @@ let stateDir = "/var/lib/ntp"; - ntpUser = "ntp"; - configFile = pkgs.writeText "ntp.conf" '' driftfile ${stateDir}/ntp.drift @@ -27,7 +25,7 @@ let ${cfg.extraConfig} ''; - ntpFlags = "-c ${configFile} -u ${ntpUser}:nogroup ${toString cfg.extraFlags}"; + ntpFlags = "-c ${configFile} -u ntp:ntp ${toString cfg.extraFlags}"; in @@ -119,11 +117,13 @@ in systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "ntpd.service"; }; - users.users.${ntpUser} = - { uid = config.ids.uids.ntp; + users.users.ntp = + { isSystemUser = true; + group = "ntp"; description = "NTP daemon user"; home = stateDir; }; + users.groups.ntp = {}; systemd.services.ntpd = { description = "NTP Daemon"; @@ -135,7 +135,7 @@ in preStart = '' mkdir -m 0755 -p ${stateDir} - chown ${ntpUser} ${stateDir} + chown ntp ${stateDir} ''; serviceConfig = { diff --git a/nixos/modules/services/networking/ntp/openntpd.nix b/nixos/modules/services/networking/ntp/openntpd.nix index 67a04d48d308..9f3892e3b538 100644 --- a/nixos/modules/services/networking/ntp/openntpd.nix +++ b/nixos/modules/services/networking/ntp/openntpd.nix @@ -61,10 +61,12 @@ in environment.etc."ntpd.conf".text = configFile; users.users.ntp = { - uid = config.ids.uids.ntp; + isSystemUser = true; + group = "ntp"; description = "OpenNTP daemon user"; home = "/var/empty"; }; + users.groups.ntp = {}; systemd.services.openntpd = { description = "OpenNTP Server";