Install Nix on Raspberry Pi 4 without hacks

Things done

  • Install Nix on Raspberry Pi 4 without the need of modifications with Raspberry Pi OS 64-bit.
  • Tested nix-info, Firefox and ROOT in nix-shell. All run smoothly.

Steps

  1. Download Raspberry Pi OS 64-bit image from here, More information can be found in this post in Raspberry Pi forum:

https://www.raspberrypi.org/forums/viewtopic.php?t=275370

  1. Write the image into an SD card with Raspberry Pi imager.
  2. Boot from the SD card prepared in the previous step.
  3. Go through the welcome wizard and update the system and software.
  4. Install Nix (multi-user mode) with
    sh <(curl -L https://nixos.org/nix/install) --daemon
    
    Detailed instruction can be found on the official website of Nix:

https://nixos.org/guides/install-nix.html

  1. Log out and log in.

Tests

  • nix-shell -p nix-info --run nix-info
  • nix-shell -p firefox --run firefox
2 Likes

Cool, I didn’t know they provide aarch64 Raspberry PI OS images now.

In case you cannot reflash the image for some reason, you can also enable a 64 bit kernel on a 32bit based Raspberry OS following this: How to Make Your Raspberry Pi 4 Faster with a 64 Bit Kernel | by Al Williams | For Linux Users | Medium
Afterwards add system = aarch64-linux to your /etc/nix/nix.conf, and you are set.

Nix doesn’t use any existing system binaries anyways, so it doesn’t matter if you are running a 64bit or 32bit based raspios, as long as your kernel is 64 bit.

1 Like