nixos: avoid simultaneous runs of nixos-rebuild services

By declaring ordering dependencies between nixos-rebuild services.
This commit is contained in:
Alexander Tomokhov 2023-12-18 23:38:29 +04:00
parent 8c9bf95c6d
commit 82b0915231

View file

@ -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";