nixos/openntpd, nixos/ntp: define group, fix after #133166

This commit is contained in:
Guillaume Girol 2021-09-17 12:00:00 +00:00 committed by Yuka
parent 88b4ba2169
commit 615db90f3d
3 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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 = {

View File

@ -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";