feat(deploy): add rollback and switch-generation just recipes #249

Merged
nimmo merged 1 commit from feat/rollback-and-generation-just-recipes into main 2026-09-21 21:22:53 +01:00
Owner

Summary

Adds two new Just recipes for generation management without rebuilding.

New recipes

just rollback

Rolls back to the previous generation without rebooting.

  • Uses the flake so it works on this flake-based config (sudo nixos-rebuild --flake .#<host> switch --rollback).
  • Preserves the current Electra specialisation (igpu/dgpu) if one is active.

just switch-generation <N>

Switches to an explicit previous generation without rebooting.

  • Validates that /nix/var/nix/profiles/system-<N>-link exists.
  • Preserves the current specialisation if one is active.
  • Sets the system profile and runs switch-to-configuration switch directly.

Validation

  • nix flake check passes.
  • The rollback recipe uses the same command pattern that was just proven on Electra in #237.
## Summary Adds two new Just recipes for generation management without rebuilding. ## New recipes ### `just rollback` Rolls back to the previous generation without rebooting. - Uses the flake so it works on this flake-based config (`sudo nixos-rebuild --flake .#<host> switch --rollback`). - Preserves the current Electra specialisation (`igpu`/`dgpu`) if one is active. ### `just switch-generation <N>` Switches to an explicit previous generation without rebooting. - Validates that `/nix/var/nix/profiles/system-<N>-link` exists. - Preserves the current specialisation if one is active. - Sets the system profile and runs `switch-to-configuration switch` directly. ## Validation - `nix flake check` passes. - The rollback recipe uses the same command pattern that was just proven on Electra in #237.
feat(deploy): add rollback and switch-generation just recipes
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m6s
37910ccba9
Author
Owner

Automated code review

Reviewed commit: 9dd9c91e54b695f2078945ea92924e59abcd7bc9

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

The PR adds two Just recipes, rollback and switch-generation, to manage NixOS system generations. The rollback recipe correctly handles Electra specialisations by reading /etc/nixos-specialisation and passing the appropriate flag to nixos-rebuild. The switch-generation recipe manually manipulates the system profile and activates a specific generation, including validation for the existence of the target generation link and the specialisation binary. The implementation is robust, handling edge cases like missing specialisation files by defaulting to base.

Blocking findings

None.

Important findings

None.

Suggestions

None.

Tests and validation

  • No configured deterministic checks.

Questions

  • Does nixos-rebuild switch --rollback automatically handle the specialisation flag in the same way as the manual implementation, or is the explicit handling necessary for all NixOS versions supported by this flake?

Review limitations

  • I cannot run just rollback or just switch-generation to verify their behavior on a live system.
  • I cannot verify the existence of /etc/nixos-specialisation or its contents on the target hosts.
  • I am assuming the nixos-rebuild and switch-to-configuration commands behave as documented.

Diff coverage

  • justfiles/deploy.just: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 1
  • Previous automated review: updated
  • Findings: 0
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `9dd9c91e54b695f2078945ea92924e59abcd7bc9` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment The PR adds two Just recipes, `rollback` and `switch-generation`, to manage NixOS system generations. The `rollback` recipe correctly handles Electra specialisations by reading `/etc/nixos-specialisation` and passing the appropriate flag to `nixos-rebuild`. The `switch-generation` recipe manually manipulates the system profile and activates a specific generation, including validation for the existence of the target generation link and the specialisation binary. The implementation is robust, handling edge cases like missing specialisation files by defaulting to base. ### Blocking findings None. ### Important findings None. ### Suggestions None. ### Tests and validation - No configured deterministic checks. ### Questions - Does `nixos-rebuild switch --rollback` automatically handle the specialisation flag in the same way as the manual implementation, or is the explicit handling necessary for all NixOS versions supported by this flake? ### Review limitations - I cannot run `just rollback` or `just switch-generation` to verify their behavior on a live system. - I cannot verify the existence of `/etc/nixos-specialisation` or its contents on the target hosts. - I am assuming the `nixos-rebuild` and `switch-to-configuration` commands behave as documented. ### Diff coverage - `justfiles/deploy.just`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 1 - Previous automated review: updated - Findings: 0 </details>
nimmo force-pushed feat/rollback-and-generation-just-recipes from 37910ccba9
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m6s
to de36680fe2
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m2s
2026-09-21 21:06:17 +01:00
Compare
nimmo force-pushed feat/rollback-and-generation-just-recipes from de36680fe2
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m2s
to 0164ec7f29
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m1s
2026-09-21 21:11:50 +01:00
Compare
nimmo force-pushed feat/rollback-and-generation-just-recipes from 0164ec7f29
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m1s
to 9dd9c91e54
All checks were successful
AI pull-request review / review (pull_request) Successful in 54s
2026-09-21 21:19:01 +01:00
Compare
nimmo merged commit 454b3e4e03 into main 2026-09-21 21:22:53 +01:00
nimmo deleted branch feat/rollback-and-generation-just-recipes 2026-09-21 21:22:56 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!249
No description provided.