feat(menu): System › Rollback — desktop generations picker (item 9b, item 9 done)
All checks were successful
Check / eval (push) Successful in 3m1s
All checks were successful
Check / eval (push) Successful in 3m1s
Undo is one menu away: the new rollback flow lists the last ten Home Manager generations (the theme/config history is already generations, newest marked current) and activates the picked one in a terminal — HM's supported rollback, reversible by re-picking a newer one, so no typed-yes gate. System-level undo deliberately links out rather than reimplementing destructive flows in rofi: the Snapshots row opens the existing gated flow, and 'boot an older generation (how)' fires an instruction notification pointing at docs/RECOVERY.md §3 (which now cross-references the menu path). V1: template-home built, generated menu bash -n clean, row rendering and pick-parsing verified against fixture generations output. V3 exercise queued. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -434,6 +434,46 @@ ${themeRows}
|
||||
|| { notify-send "Snapshots" "Snapshot tools unavailable (nomarchy.system.snapper off?)."; exit 0; }
|
||||
exec ${cfg.terminal} -e sudo nomarchy-snapshots ;;
|
||||
|
||||
rollback)
|
||||
# Undo, one menu away (informative + rock-stable). Desktop =
|
||||
# Home Manager generations: theme/config history is already one
|
||||
# generation per change, and running an older generation's
|
||||
# activate script is the supported HM rollback — reversible by
|
||||
# activating a newer one again, so no typed-yes gate here.
|
||||
# System-level undo deliberately LINKS OUT instead of putting
|
||||
# destructive flows in rofi: boot-menu generations and snapper
|
||||
# rollback have their own homes and gates (docs/RECOVERY.md,
|
||||
# nomarchy-snapshots).
|
||||
gens=$(home-manager generations 2>/dev/null | head -10)
|
||||
choice=$( {
|
||||
if [ -n "$gens" ]; then
|
||||
printf '%s\n' "$gens" | awk '{
|
||||
printf "Desktop gen %s — %s %s%s\n", $5, $1, $2, (NR==1 ? " (current)" : "")
|
||||
}' | while IFS= read -r line; do row "$line" document-open-recent; done
|
||||
fi
|
||||
command -v nomarchy-snapshots >/dev/null 2>&1 \
|
||||
&& row "System files → Snapshots" timeshift
|
||||
row "System config → boot an older generation (how)" help-about
|
||||
back
|
||||
} | rofi -dmenu -show-icons -p Rollback) || exit 0
|
||||
case "$choice" in
|
||||
"$BACK") exec "$0" system ;;
|
||||
"Desktop gen "*)
|
||||
num=''${choice#Desktop gen }; num=''${num%% *}
|
||||
path=$(printf '%s\n' "$gens" | awk -v n="$num" '$5 == n { print $7 }')
|
||||
[ -x "$path/activate" ] \
|
||||
|| { notify-send "Rollback" "Generation $num not found on disk."; exit 1; }
|
||||
exec ${cfg.terminal} -e sh -c "
|
||||
echo \"Activating Home Manager generation $num…\"; echo
|
||||
\"$path/activate\"
|
||||
echo; echo \"Desktop rolled back to generation $num.\"
|
||||
echo \"(Roll forward the same way — newer generations stay listed.)\"
|
||||
printf 'Enter to close.'; read -r _" ;;
|
||||
*Snapshots*) exec "$0" snapshot ;;
|
||||
*"older generation"*)
|
||||
notify-send "System rollback" "Reboot and pick an older NixOS generation in the boot menu (the last 10 are kept). Make it stick: revert the change in ~/.nomarchy, then sys-rebuild. Details: docs/RECOVERY.md §3." ;;
|
||||
esac ;;
|
||||
|
||||
tools)
|
||||
# Tools submenu — utilities you invoke. Each leaf is also reachable
|
||||
# directly (SUPER+CTRL+<mnemonic>); this just keeps the root short.
|
||||
@@ -487,6 +527,7 @@ ${themeRows}
|
||||
fi
|
||||
fi
|
||||
command -v nomarchy-snapshots >/dev/null 2>&1 && row "Snapshots" timeshift
|
||||
row "Rollback" edit-undo
|
||||
if [ -e "''${bats[0]}" ] && command -v powerprofilesctl >/dev/null 2>&1; then
|
||||
row "Power profile" preferences-system-power
|
||||
fi
|
||||
@@ -505,6 +546,7 @@ ${themeRows}
|
||||
*"Auto timezone"*) exec "$0" autotimezone ;;
|
||||
*"Auto-commit"*) exec "$0" autocommit ;;
|
||||
*Snapshots*) exec "$0" snapshot ;;
|
||||
*Rollback*) exec "$0" rollback ;;
|
||||
*"Power profile"*) exec "$0" power-profile ;;
|
||||
esac ;;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user