Setup RPi from NixOS image
The recommended approach to setup your RPi for this project is the use the released images as part of this repository. If you are having issue with the release images or want to build your RPi starting from a plain NixOS image, you can follow these instructions.
Warning
This procedure in not actively used so instructions may get outdated.
These steps are simplified from this original source.
- Download the latest NixOS build for your RPi from Hydra.
- Flash on to an SD card using your favourite flashing tool.
rpi-imager,balena-etcherordd. - Choose one
- Wire a screen, keyboard and mouse to the RPi OR
- Wire the FTDI cable
- Connect the TX/RX wires to GPIOs 14 and 15.
- Plug the USB to you machine, noticing the port assigned to it. You can used
dmesg -w. - Use
picocom -b 115200 /dev/ttyUSB<X>to monitor the boot.
- Place the SD card in your RPi and power it.
- if using an FTDI cable, wait for a minute or so after
starting kernel...is printed and continue…- Enable UART
- Power off the RPi and remove the SD card.
- Mount the SD card back on you machine.
- Open
NIXOS_SD/boot/extlinux/extlinux.conf - Edit the
APPENDline by replacingconsole=ttyS0,115200n8withconsole=ttyS1,115200n8. - Save and unmount the SD card.
- Place the SD card back in the RPi and supply power.
- Enable UART
- Setup the OS
- Plug-in an Ethernet cable.
- Install git:
nix-shell -p git - Clone this repository:
git clone https://github.com/hicklin/immich-rpi-nix.git - Create a symbolic link (shortcut), for our NixOS configuration:
sudo ln -s ~/immich-rpi-nix/configuration.nix /etc/nixos/configuration.nix - Change the RPi login password by changing the
hashedPasswordinimmich-rpi-nix/configuration.nix
- You can generate a hash with
mkpasswd -m sha-512 <your secure password>. Note the space at the start. This omits this command from being logged in history and leaking your password.
Caution
This password is necessary to manage the RPi. If this is breached, attackers can access all of the raw media assets. Set a secure password and for better security, setup SSH keys and disable password authentication.
- Update channels:
sudo nix-channel --update - Install all necessary services and applications:
sudo nixos-rebuild switch - Now you can ssh into the RPi with
ssh immich@<IP>and the password set in step 5.