Installing NixOS on Raspberry PI 3B
This is assumed that you already have access to a running NixOS System..
Initial Configuration
-
Download SD Image from Hydra.
-
Allow main development system to build derivations off of its machine emulating
aarch64
architecture so as to not choke out the Raspberry PI. to main development system to build derivations off the machine to not choke out the PI.
# configuration.nix
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
Build Configuration
- Build the configuration on your workstation and take note of the store path that is ouputted.
nix build .#nixosConfigurations.beer.config.system.build.toplevel --print-out-paths
# Example Path
/nix/store/randomarbitraryhashavc-nixos-system-beer-23.05.20230626.ab3331
Initial Install
- Boot SD Image on PI and make sure SSH is accessible
- Copy the built files over to the PI
nix copy [the path above] --to ssh://root@[pi]
- Install NixOS on the PI
nixos-install --root / --system [the path above]
Subsequent Installs
Use the remote rebuild functionality of nixos-rebuild
NIX_SSHOPTS="-t -p 22" nixos-rebuild switch --flake .#beer --target-host remoteuser@beer --use-remote-sudo