diff --git a/.forgejo/workflows/nixos.yaml b/.forgejo/workflows/nixos.yaml index d4b3144..06bbefc 100644 --- a/.forgejo/workflows/nixos.yaml +++ b/.forgejo/workflows/nixos.yaml @@ -81,6 +81,14 @@ jobs: continue fi echo "== $host" + # nixos-rebuild runs the activation as a fixed transient unit; + # while an earlier one still runs (it waits for one-shot units + # it started), a new switch fails with a misleading sudo error + for i in $(seq 1 120); do + nix develop -c ssh "$host" 'systemctl is-active -q nixos-rebuild-switch-to-configuration.service' || break + echo "$host: an earlier activation is still running, waiting" + sleep 10 + done nix develop -c nixos-rebuild switch --flake ".#$host" \ --target-host "$host" --build-host "$host" --sudo done