“How does Mobile NixOS boot?”

This is what this documentation topic tries to describe. This is for end-users.

For developers, see in-depth topics.

Booting Mobile NixOS

Most devices targeted by Mobile NixOS are intended to boot only one kernel at a time, with one stage-1, and one system.

NixOS, in turn, shines when a system can choose a generation, which has its own kernel, stage-1, and system build.

Mobile NixOS, at this point in time, sits on the halfway point. The user cannot choose which generation a kernel and stage-1 comes from, but can boot a specific generation.

Booting a specific generation

This is done through booting in "recovery mode". This will stop the stage-1 process before it jumps into the default generation, and will allow you to select a system to boot into.

The method to enter recovery mode depends on your device

Android-based devices

Android-based devices can be booted in their respective recovery mode.

When the device is a "Boot as recovery" system, no other setup than flashing the boot partition is required. "Boot as recovery" systems are generally newer Android-based devices.

When the device is not a "Boot as recovery", or still uses a recovery partition, you will need to flash a recovery image to the recovery partition.

 $ nix-build --argstr device $DEVICE -A outputs.android-recovery
 $ fastboot flash recovery result

All other devices

Including the default boot partition for Android-based devices.

When the boot process is about to switch to the system, if any of the following keys are held, it will instead show the recovery menu.

  • Volume up

  • Volume down

  • Left shift

  • Right shift

  • Left control

  • Right control

  • Escape

Testing the boot GUI

The simulator can be launched using the following commands:

 $ nix-build --argstr device uefi-x86_64 -A pkgs.boot-recovery-menu-simulator
 $ result/bin/simulator --resolution 1080x1920