Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The nix-badge command

nix-badge is BadgeOS’s own tool, written in Zig. Some of its subcommands are what the badge’s services run, and the rest are for you. Run it without arguments for a usage summary.

Commands for you

nix-badge power prints the system rail (VSEL, about 5 V on USB power) and the battery pack’s voltage with an estimate of how much charge is left. The pack is three AA primaries, so there’s no charging state.

nix-badge core arm, nix-badge core riscv and nix-badge core status set and read the core-select latch (see Switching CPU cores).

nix-badge bling show prints the LED ring’s settings, and sudo nix-badge bling set changes them in /etc/nix-badge/leds.conf, keeping whatever you don’t pass:

FlagSetting
--brightness 0-255Brightness
--fps NFrame rate
--count NNumber of LEDs
--speed-hz HZSPI clock
--bits 3|4|8SPI bits per LED data bit
--eval PATHA Nix pattern (see LED ring and OLED screens)
--blob PATHA prerecorded animation to play instead of a pattern

nix-badge board-id decodes the identity fused into the SoC. On its own it prints every field, whether the badge is provisioned, and the state of the device key. --serial and --product print a single field, and --store-path prints the Nix store path of the PCB design that the badge was built from, which is also burned into its eFuses. With a field flag it exits non-zero if that field isn’t fused.

sudo nix-badge mmio read ADDR and sudo nix-badge mmio write ADDR VALUE read and write 32-bit physical registers. Be careful with it: reading a block that isn’t clocked can hang the whole SoC. The kernel never lets it at RAM, and lets it at a register a driver has claimed (see /proc/iomem) only when the badge was booted with iomem=relaxed added to the kernel command line by hand.

nix-badge fix-selftest and nix-badge nix-selftest smoke-test the two Nix evaluators (see Evaluators). The upstream Nix one is only built on ARM.

Commands the services run

CommandServiceWhat it does
nix-badge bling runnix-badge-blingDrives the LED ring
nix-badge olednix-badge-oledRuns the OLED screens and reads BUTTON
nix-badge bootswapnix-badge-bootswapSwitches cores when BOOT is held for 3 seconds (see Switching CPU cores)