about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/networking/ntp/chrony.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-20 14:55:32 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-20 14:55:32 +0100
commit34b58aaefccdb5c64b912903973ba729bae58be3 (patch)
treee18a96bc0f066422356a8da655453403baa97e64 /nixpkgs/nixos/modules/services/networking/ntp/chrony.nix
parent7be318098d7fe87d896e8787bfadc0345149cb59 (diff)
parent3fb937a1e9f4157f57011965b99fcb7f4139d9ad (diff)
downloadnixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.gz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.bz2
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.lz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.xz
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.tar.zst
nixlib-34b58aaefccdb5c64b912903973ba729bae58be3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/nixos/modules/services/networking/ntp/chrony.nix')
-rw-r--r--nixpkgs/nixos/modules/services/networking/ntp/chrony.nix27
1 files changed, 21 insertions, 6 deletions
diff --git a/nixpkgs/nixos/modules/services/networking/ntp/chrony.nix b/nixpkgs/nixos/modules/services/networking/ntp/chrony.nix
index d370e6946d7b..3f10145033c5 100644
--- a/nixpkgs/nixos/modules/services/networking/ntp/chrony.nix
+++ b/nixpkgs/nixos/modules/services/networking/ntp/chrony.nix
@@ -162,7 +162,7 @@ in
       };
 
       extraFlags = mkOption {
-        default = [];
+        default = [ ];
         example = [ "-s" ];
         type = types.listOf types.str;
         description = lib.mdDoc "Extra flags passed to the chronyd command.";
@@ -178,7 +178,8 @@ in
     users.groups.chrony.gid = config.ids.gids.chrony;
 
     users.users.chrony =
-      { uid = config.ids.uids.chrony;
+      {
+        uid = config.ids.uids.chrony;
         group = "chrony";
         description = "chrony daemon user";
         home = stateDir;
@@ -202,12 +203,13 @@ in
     ];
 
     systemd.services.chronyd =
-      { description = "chrony NTP daemon";
+      {
+        description = "chrony NTP daemon";
 
         wantedBy = [ "multi-user.target" ];
-        wants    = [ "time-sync.target" ];
-        before   = [ "time-sync.target" ];
-        after    = [ "network.target" "nss-lookup.target" ];
+        wants = [ "time-sync.target" ];
+        before = [ "time-sync.target" ];
+        after = [ "network.target" "nss-lookup.target" ];
         conflicts = [ "ntpd.service" "systemd-timesyncd.service" ];
 
         path = [ chronyPkg ];
@@ -255,5 +257,18 @@ in
           SystemCallFilter = [ "~@cpu-emulation @debug @keyring @mount @obsolete @privileged @resources" "@clock" "@setuid" "capset" "@chown" ];
         };
       };
+
+    assertions = [
+      {
+        assertion = !(cfg.enableRTCTrimming && builtins.any (line: (builtins.match "^ *rtcsync" line) != null) (lib.strings.splitString "\n" cfg.extraConfig));
+        message = ''
+          The chrony module now configures `rtcfile` and `rtcautotrim` for you.
+          These options conflict with `rtcsync` and cause chrony to crash.
+          Unless you are very sure the former isn't what you want, please remove
+          `rtcsync` from `services.chrony.extraConfig`.
+          Alternatively, disable this behaviour by `services.chrony.enableRTCTrimming = false;`
+        '';
+      }
+    ];
   };
 }