- Host setup in
configuration.nix
(if your host has another architecture (e.g. x86_64) than the raspberry pi)
boot.binfmt.emulatedSystems = ["aarch64-linux"];
nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems;
- Update
common.nix
In particular, don't forget:
- to configure your network
- to change the admin user able to connect through ssh
- add hosts public ssh key to connect without password
- Build the image
nix build -L .#nixosConfigurations.pi4.config.system.build.sdImage
- Copy the image in your sd card
DEVICE=/dev/sdd # Whatever your sd card reader or usb device is
sudo dd if=result/sd-image/pi.img of=$DEVICE bs=1M conv=fsync status=progress
-
Boot your Pi
-
From another machine, rebuild the system:
For Pi 4:
nix --extra-experimental-features nix-command --extra-experimental-features flakes run --system aarch64-linux github:serokell/deploy-rs .#pi4 -- --ssh-user pi --hostname 10.10.10.74
- Various features are much better supported on the Pi 4 than on the Zero 2 W because the Pi 4 has a
nixos-hardware
profile.- Note that
nixos-rebuild --target-host
would work instead of usingdeploy-rs
. but asnixos-rebuild
is not available on Darwin, I'm usingdeploy-rs
that works both on NixOS and Darwin.
- Note that
- the
sdImage.extraFirmwareConfig
option is not ideal as it cannot updateconfig.txt
after it is created in the sd image.