Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

  1. Download the latest NixOS build for your RPi from Hydra.
  2. Flash on to an SD card using your favourite flashing tool. rpi-imager, balena-etcher or dd.
  3. 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.
  4. Place the SD card in your RPi and power it.
  5. if using an FTDI cable, wait for a minute or so after starting kernel... is printed and continue…
    1. Enable UART
      1. Power off the RPi and remove the SD card.
      2. Mount the SD card back on you machine.
      3. Open NIXOS_SD/boot/extlinux/extlinux.conf
      4. Edit the APPEND line by replacing console=ttyS0,115200n8 with console=ttyS1,115200n8.
      5. Save and unmount the SD card.
    2. Place the SD card back in the RPi and supply power.
  6. Setup the OS
    1. Plug-in an Ethernet cable.
    2. Install git:
      nix-shell -p git
      
    3. Clone this repository:
      git clone https://github.com/hicklin/immich-rpi-nix.git
      
    4. Create a symbolic link (shortcut), for our NixOS configuration:
      sudo ln -s ~/immich-rpi-nix/configuration.nix /etc/nixos/configuration.nix
      
    5. Change the RPi login password by changing the hashedPassword in immich-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.

    1. Update channels:
      sudo nix-channel --update
      
    2. Install all necessary services and applications:
      sudo nixos-rebuild switch
      
    3. Now you can ssh into the RPi with ssh immich@<IP> and the password set in step 5.