Skip to content

Instantly share code, notes, and snippets.

@chrisguida
Last active June 8, 2024 03:40
Show Gist options
  • Save chrisguida/170e4ff6b48aabeb0ab0351f82878403 to your computer and use it in GitHub Desktop.
Save chrisguida/170e4ff6b48aabeb0ab0351f82878403 to your computer and use it in GitHub Desktop.
Installing NixOS on a Raspberry Pi 4B with an SSD as the boot drive

Installing NixOS on a Raspberry Pi 4B with an SSD as the boot drive

You will need:

  • A Pi 4B
  • A USB-C power supply (probably the official one)
  • An ethernet cable
  • A microsd card
  • An SSD, I used the Samsung T7 2TB
  • A powered USB hub (THIS IS ABSOLUTELY REQUIRED OR YOU WILL HAVE TOTALLY UNPREDICTABLE FAILURES AND CORRUPTION)

Flash the SSD with the NixOS .img file you downloaded from Hydra (intended to flash on an sd card, but you can just flash it straight to the SSD using the following command):

(Obviously change the filename to the one you downloaded)

sudo dd if=nixos-sd-image-24.11pre635424.e8057b67ebf3-aarch64-linux.img of=/dev/sdb bs=4096 conv=fsync status=progress

Make sure you allow USB boot first with the RaspiOS official imager. Update the firmware first:

# nix-shell -p raspberrypi-eeprom
# mount /dev/disk/by-label/FIRMWARE /mnt
# BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable rpi-eeprom-update -d -a

Then just flash the microsd card with the "change the boot order" image.

I did sd card first, then USB if sd card is missing. That way we can install using the sd card and then boot from USB once the install is complete.

Now update the config as detailed in these instructions here

For some reason when I did the rebuild I could no longer access the ethernet network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment