Skip to content

Commit

Permalink
nixos/chrony: move to StateDirectory and tmpfiles.d
Browse files Browse the repository at this point in the history
  • Loading branch information
flokli committed Apr 2, 2020
1 parent 98906df commit f25a301
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions nixos/modules/services/networking/ntp/chrony.nix
Expand Up @@ -92,6 +92,11 @@ in

systemd.services.systemd-timedated.environment = { SYSTEMD_TIMEDATED_NTP_SERVICES = "chronyd.service"; };

systemd.tmpfiles.rules = [
"d ${stateDir} 0755 chrony chrony - -"
"f ${keyFile} 0640 chrony chrony -"
];

systemd.services.chronyd =
{ description = "chrony NTP daemon";

Expand All @@ -103,13 +108,6 @@ in

path = [ pkgs.chrony ];

preStart = ''
mkdir -m 0755 -p ${stateDir}
touch ${keyFile}
chmod 0640 ${keyFile}
chown chrony:chrony ${stateDir} ${keyFile}
'';

unitConfig.ConditionCapability = "CAP_SYS_TIME";
serviceConfig =
{ Type = "simple";
Expand All @@ -118,7 +116,7 @@ in
ProtectHome = "yes";
ProtectSystem = "full";
PrivateTmp = "yes";

StateDirectory = "chrony";
};

};
Expand Down

0 comments on commit f25a301

Please sign in to comment.