- Update
zero2w.nix
In particular, don't forget:
- to configure your wifi
- to add an admin user able to connect through ssh
- Build the image This builds a full linux kernel and can take multiple hours. Subsequent builds will be faster because the package artifacts will be cached. From an x86_64-linux host machine, run:
nix build -L .#nixosConfigurations.x86_64-linux.zero2w.config.system.build.sdImageFrom an aarch64 host machine, run:
nix build -L .#nixosConfigurations.aarch64-linux.zero2w.config.system.build.sdImage- Copy the image in your sd card
DEVICE=/dev/disk5 # Whatever your sd card reader is
sudo dd if=result/sd-image/zero2.img of=$DEVICE bs=1M conv=fsync status=progress- Boot your Zero
- Get your IP
ifconfig wlan0- From another machine, rebuild the system:
ZERO2_IP=<the-zero2-ip>
SSH_USER=<the-admin-user-in-the-pi>
nix run github:serokell/deploy-rs .#zero2w -- --ssh-user $SSH_USER --hostname $ZERO2_IP- The Zero 2 doesn't have enough RAM to build itself. An initial lead was to create a swap partition, but it turns out it was a bad idea, as it would have decreased the sd card lifetime (sd cards don't like many write operations). A
zramswap is not big enough to work. Hence the use ofdeploy-rs.- Note that
nixos-rebuild --target-hostwould work instead of usingdeploy-rs. but asnixos-rebuildis not available on Darwin, I'm usingdeploy-rsthat works both on NixOS and Darwin.
- Note that
- I still couldn't find a way to use
boot.kernelPackages = pkgs.linuxKernel.packages.linux_rpi3. - the
sdImage.extraFirmwareConfigoption is not ideal as it cannot updateconfig.txtafter it is created in the sd image. - An overlay in the
hardware.deviceTreehas activated the i2c bus. This means that thei2c-toolsare now working!