> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jylhis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Updating & Rollback

> Keep a Marchyo system current and roll back safely

Marchyo is a NixOS flake, so updating and rolling back use the standard Nix
machinery — there is no bespoke updater or "update channel" to manage. Every
`nixos-rebuild switch` builds a new **generation** you can boot back into if
something breaks.

## Update your system

Bump the pinned inputs (including `marchyo` itself), then rebuild:

```bash theme={}
# In the directory holding your flake.nix
nix flake update            # bump every input to its latest
# or bump just Marchyo:
nix flake update marchyo

sudo nixos-rebuild switch --flake .#yourhost
```

On macOS use `darwin-rebuild switch --flake .#yourhost` instead.

<Note>
  `nix flake update` rewrites `flake.lock`. Commit the updated lock file so the
  change is reproducible and reviewable — the lock is the single source of truth
  for what your system is built from.
</Note>

## What "update" actually moves

Marchyo's builders pick the package set for you, so an update tracks different
channels depending on the system (see the [Introduction](/introduction)):

* **Linux and `aarch64-darwin`** ride **nixpkgs unstable**.
* **`x86_64-darwin`** is pinned to **stable nixos-26.05** (the last release
  supporting Intel macOS).

You do not add a separate `nixpkgs` input — updating the `marchyo` input is what
advances your packages.

## Roll back

If a rebuild misbehaves, roll back to the previous generation:

```bash theme={}
sudo nixos-rebuild switch --rollback
```

Or pick any earlier generation from the **boot menu** (systemd-boot / GRUB) at
startup — each generation is a separate boot entry. To inspect or prune them:

```bash theme={}
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
sudo nix-collect-garbage -d      # remove old generations + free the store
```

<Note>
  Unlike Btrfs snapshot systems, NixOS generations capture the **system closure**,
  not your home files. `~` is untouched by a rollback. Roll back to undo a broken
  system change; use your own backups for personal data.
</Note>

## Developing on the Marchyo repo itself

If you have a checkout of Marchyo (rather than consuming it as an input), use the
`just` recipes — `just update` bumps the flake inputs **and** re-syncs
`devenv.lock` to the same `nixpkgs` revision, and `just verify` checks they stay
aligned:

```bash theme={}
just update    # nix flake update + sync devenv.lock
just verify    # confirm flake.lock and devenv.lock agree
just check     # nix flake check (evaluation tests)
```
