Rollback
glixos has two layers of recovery; both are designed so that the manifest and the running system never disagree silently.
See ADR-008.
Layer 1: in-flight transactional rollback
Every mutating glix command (add, remove, enable, disable, set,
update) follows the same pattern:
- Take an in-memory snapshot of
glix.toml,flake.nix, andflake.lock. - Write the desired changes.
- Run
nix flake lock. - If step 3 fails, restore from the snapshot and return the error.
- If everything succeeded,
git add -A && git commit -m "...".
You get a working tree every time, even on failures. Nothing for you to do.
Layer 2: glix rollback
If a successful mutation produces a system you don't want, run:
glix rollback
This reverts the last commit in the user-packages repo (git revert HEAD) and runs nix flake lock against the restored manifest. Now
flake.nix and glix.toml describe the system as it was before the
last change.
To also roll back the running generation:
sudo nixos-rebuild --rollback switch
glix rollback
Order matters: if you glix rollback first, then your manifest matches
the previous-previous generation, which is fine if you also rebuild.
The general rule: reach a clean state on both sides before doing
anything else.
You can also chain them:
glix rollback --apply # revert manifest + nixos-rebuild switch
--apply runs nixos-rebuild switch after the revert, so the running
system tracks the manifest.
What glix rollback does not do
- It does not call
nixos-rebuild --rollbackautomatically. That's a separate, system-level operation; you may want a generation rollback without touching the manifest, or vice versa. Layer 2 keeps the two decisions independent. - It does not revert through arbitrary history. Repeat
glix rollbackto step back multiple commits. For surgical changes, usegit revert <sha>followed bynix flake lock.
Auditing your history
Every glix mutation is one commit with a descriptive subject:
glix add laptop: pkg-greeting (path:..., home, via uri)
glix set laptop: pkg-greeting (config.message=Hello)
glix remove laptop: pkg-hello
glix update laptop: all inputs
cd ~/.config/glixos
git log --oneline
This is the audit trail. Treat it like a normal git history; git revert,
git diff, and tagging all behave normally.