Minimal NixOS configuration for Raspberry Pi Compute Module 5 on eMMC
- Nix 76.2%
- Shell 23.8%
|
|
||
|---|---|---|
| .forgejo | ||
| nixos | ||
| .gitignore | ||
| 99-cm5-usbboot.rules | ||
| flake.lock | ||
| flake.nix | ||
| flash.sh | ||
| id_root | ||
| README.md | ||
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
- Power the IO board off.
- Fit jumper J2 pins 1-2 (
nRPIBOOT) to force USB boot instead of eMMC. - 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
- 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.