From 82b091523100bae788bac4574bbe57473eefeb69 Mon Sep 17 00:00:00 2001 From: Alexander Tomokhov Date: Mon, 18 Dec 2023 23:38:29 +0400 Subject: [PATCH] nixos: avoid simultaneous runs of nixos-rebuild services By declaring ordering dependencies between nixos-rebuild services. --- nixos/module.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/module.nix b/nixos/module.nix index 96605eb..20873a8 100644 --- a/nixos/module.nix +++ b/nixos/module.nix @@ -109,6 +109,8 @@ in }; # One shot systemd service to upgrade NixOS using nixos-rebuild systemd.services.sp-nixos-upgrade = { + # protection against simultaneous runs + after = [ "sp-nixos-rebuild.service" ]; description = "Upgrade NixOS and SP modules to latest versions"; environment = config.nix.envVars // { HOME = "/root"; @@ -128,6 +130,8 @@ in }; # One shot systemd service to rollback NixOS using nixos-rebuild systemd.services.sp-nixos-rollback = { + # protection against simultaneous runs + after = [ "sp-nixos-rebuild.service" "sp-nixos-upgrade.service" ]; description = "Rollback NixOS using nixos-rebuild"; environment = config.nix.envVars // { HOME = "/root";