YOUR JOURNEY
09 / 18
02THE NIXOS SYSTEM 5 MIN READ
LESSON 09 / BUILD, TEST, SWITCH

Make a change.
Choose when.

Building a system and activating it are different actions.

NixOS gives you separate steps to prepare a configuration, try it now, or make it your normal boot choice.

Explore the lesson
~$ NixOS examples · try them in a VM.
SYSTEM GENERATIONS01 / 03
Drag to rotate

Build creates an output without activating it.

New build ready; old system active
09.1THREE USEFUL COMMANDS

Pick the scope of the change.

On NixOS, nixos-rebuild build produces a system output without activating it. test activates it for the running system without setting it as the default for the next boot. switch does both.

boot is another option: it updates the boot configuration but leaves the current running system unchanged. Kernel changes still require a reboot to run the new kernel, even after switch.

terminal · NixOS only
# From a configured NixOS machine:
sudo nixos-rebuild build
 
# Try the new configuration in the running system:
sudo nixos-rebuild test
 
# Activate and make it the normal boot choice:
sudo nixos-rebuild switch
Next section: A successful build is one checkpoint.
09.2READ BEFORE YOU ACTIVATE

A successful build is one checkpoint.

Check the affected services after activation. If you changed a service, use systemctl status and journalctl to inspect it. A valid configuration can still contain the wrong value for your machine.

Each successful switch selects a system generation. Existing generations can remain available as recovery options, which is the subject of the next lesson.

TAKE THIS WITH YOU

Build prepares; test activates temporarily; switch activates and updates the boot default.

UP NEXT

Generations & rollbacks

A system update selects a new generation, while the old one can remain.

Next lesson