From ac3c9c7de61d2ae4533df5a43d251c88672e1340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sat, 7 Feb 2026 06:06:47 +0100 Subject: [PATCH] fix: prevent listener service from restarting during deployment Add stopIfChanged and restartIfChanged options to prevent the listener from being interrupted when nixos-rebuild switch activates a new configuration that changes the service definition. Co-Authored-By: Claude Opus 4.5 --- nixos/module.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/module.nix b/nixos/module.nix index efdd1a2..d17a68e 100644 --- a/nixos/module.nix +++ b/nixos/module.nix @@ -103,6 +103,11 @@ in after = [ "network-online.target" ]; wants = [ "network-online.target" ]; + # Prevent self-interruption during nixos-rebuild switch + # The service will continue running the old version until manually restarted + stopIfChanged = false; + restartIfChanged = false; + environment = cfg.environment // { # Nix needs a writable cache for git flake fetching XDG_CACHE_HOME = "/var/cache/homelab-deploy";