Chapters

Selecting a system generation

Run deploy.sh from the Copland checkout. Replace HOST with your host's name in the root evaluator. The examples below use local to apply the configuration to the machine you are currently using.

Build

build builds the system and prints its Nix store path. It does not activate the configuration or change the boot selection.

./deploy.sh build HOST

The other actions also build the selected configuration first, so a separate build is optional.

Test

test activates the new configuration now without changing the generation selected for the next boot. Use it to try a change before making it the boot default.

./deploy.sh test HOST local

This is a live activation, not a dry run. Services and system configuration change immediately, while the next normal boot still uses the previously selected generation.

Boot

boot selects the new generation for the next boot without activating it now. The currently running configuration stays in place, and the command does not reboot the machine.

./deploy.sh boot HOST local

Switch

switch activates the new configuration now and selects it for the next boot. This is the usual command for applying a system update.

./deploy.sh switch HOST local

The running kernel changes only after a reboot. Home activation is included for users enabled through homeEnvironment.users.

Rollback

Automatic rollback

If activation or service startup fails during a switch, Copland runs the previous generation's activation and restores its service setup. If stopping an old service fails, it does not start replacements. deploy.sh also restores the previous system profile and boot selection when an operation that changed them fails.

This recovery belongs to the switch process. It does not monitor later application failures or restore application data from ZFS snapshots.

Available generations

The system profile records the generations available for selection. List them with:

nix-env --profile /nix/var/nix/profiles/system --list-generations

The current marker refers to the profile's selected generation. After test or boot, that can differ from the running system, whose store path is available through:

readlink -f /run/current-system

Trying an older generation

Use an older generation's own activation command to run it without rebuilding your checkout. Replace 42 with a generation number from the list:

doas /nix/var/nix/profiles/system-42-link/bin/switch-to-configuration test

This activates generation 42 without changing the boot selection. Your repository files remain as they are.

Keeping the older generation

After testing the older generation, select it in the system profile:

doas nix-env --profile /nix/var/nix/profiles/system --switch-generation 42

Once that succeeds, update the boot selection using the selected generation:

doas /nix/var/nix/profiles/system/bin/switch-to-configuration boot

These are separate operations. Selecting the Nix profile generation changes the profile link, and the second command updates the bootloader. A later deploy.sh switch builds from your checkout again, so keep its configuration aligned with the version you want to run.