diff --git a/services/arr/recyclarr.nix b/services/arr/recyclarr.nix index 62b3359..ebddbce 100644 --- a/services/arr/recyclarr.nix +++ b/services/arr/recyclarr.nix @@ -190,9 +190,19 @@ in }; }; - # Re-sync immediately on deploy when the recyclarr config changes + # Trigger immediate sync on deploy when recyclarr config changes. + # restartTriggers on the oneshot service are unreliable (systemd may + # no-op a restart of an inactive oneshot). Instead, embed a config + # hash in the timer unit -- NixOS restarts changed timers reliably, + # and OnActiveSec fires the sync within seconds. + systemd.timers.recyclarr = { + timerConfig.OnActiveSec = "5s"; + unitConfig.X-ConfigHash = builtins.hashString "sha256" ( + builtins.toJSON config.services.recyclarr.configuration + ); + }; + systemd.services.recyclarr = { - restartTriggers = [ (builtins.toJSON config.services.recyclarr.configuration) ]; after = [ "network-online.target" "radarr.service"