From b8cbf0fbf5713286fe0ccbb8ca112c99aefec58b Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Tue, 17 Nov 2026 10:21:13 +0400 Subject: [PATCH] nixos: deploys do not kill a running backup or replica The daily replica that started at 06:09:59 was stopped 41 seconds later by a deploy that changed its unit, and mailed a failure. Long one-shot jobs keep running through a switch now; the next run uses the new unit. Assisted-by: Claude:opus-5-5 --- nixos/hosts/asxpio-services/replica.nix | 2 ++ nixos/modules/backup.nix | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nixos/hosts/asxpio-services/replica.nix b/nixos/hosts/asxpio-services/replica.nix index 00cc4b2..9f42f98 100644 --- a/nixos/hosts/asxpio-services/replica.nix +++ b/nixos/hosts/asxpio-services/replica.nix @@ -54,6 +54,8 @@ in wants = [ "network-online.target" ]; after = [ "network-online.target" ]; onFailure = [ "alert-mail@%n.service" ]; + # A deploy that changes this unit must not kill a running replica + restartIfChanged = false; path = [ pkgs.rclone ]; # rclone looks for a home directory even when its remotes come from # the environment diff --git a/nixos/modules/backup.nix b/nixos/modules/backup.nix index 8eb05e2..044e78e 100644 --- a/nixos/modules/backup.nix +++ b/nixos/modules/backup.nix @@ -153,6 +153,8 @@ in wants = [ "network-online.target" ]; after = [ "network-online.target" ]; onFailure = [ "alert-mail@%n.service" ]; + # A deploy that changes this unit must not kill a running backup + restartIfChanged = false; serviceConfig = { Type = "oneshot"; ExecStart = "${script}/bin/restic-backup run";