Minimal NixOS configuration for Raspberry Pi Compute Module 5 on eMMC
  • Nix 76.2%
  • Shell 23.8%
Find a file
sid 919ab250ab
All checks were successful
Release image / release (push) Successful in 5m58s
initial commit
2026-09-15 18:01:36 +02:00
.forgejo initial commit 2026-09-15 18:01:36 +02:00
nixos initial commit 2026-09-15 18:01:36 +02:00
.gitignore initial commit 2026-09-15 18:01:36 +02:00
99-cm5-usbboot.rules initial commit 2026-09-15 18:01:36 +02:00
flake.lock initial commit 2026-09-15 18:01:36 +02:00
flake.nix initial commit 2026-09-15 18:01:36 +02:00
flash.sh initial commit 2026-09-15 18:01:36 +02:00
id_root initial commit 2026-09-15 18:01:36 +02:00
README.md initial commit 2026-09-15 18:01:36 +02:00

NixOS on Raspberry Pi Compute Module 5

Minimal NixOS configuration for Raspberry Pi Compute Module 5 on Compute Module 5 IO Board (eMMC).

Build

Cross-compile the image (Raspberry Pi firmware + NixOS root):

nix build .#nixosConfigurations.cm5.config.system.build.sdImage --accept-flake-config

Output: result/sd-image/nixos-image-rpi5-kernel.img.zst

Flash eMMC

  1. Power the IO board off.
  2. Fit jumper J2 pins 1-2 (nRPIBOOT) to force USB boot instead of eMMC.
  3. Connect the host to J11 (USB-C), then power on.
zstd -d result/sd-image/nixos-image-rpi5-kernel.img.zst -o sd-card.img
nix run .#flash -- sd-card.img
  1. Unplug J11, remove the J2 jumper, power-cycle to boot from eMMC.

SSH

ssh -i id_root -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.100.2

Rebuild

NIX_SSHOPTS="-i id_root" nixos-rebuild switch --flake .#cm5 --target-host root@192.168.100.2

udev rule

Lets an unprivileged user run rpiboot and dd to the eMMC.

sudo install -m 0644 99-cm5-usbboot.rules /etc/udev/rules.d/99-cm5-usbboot.rules
sudo udevadm control --reload

Make sure your user is in group dialout.

References: