No description
Find a file
2024-01-18 12:34:04 -07:00
images Preparing zw system 2024-01-18 12:34:04 -07:00
systems Preparing zw system 2024-01-18 12:34:04 -07:00
.gitignore Add pi sd card image building flake and homepi system 2023-12-27 15:30:15 -07:00
flake.lock Update di-tui/ess versions 2024-01-18 10:42:36 -07:00
flake.nix Preparing zw system 2024-01-18 12:34:04 -07:00
README.md Add pi sd card image building flake and homepi system 2023-12-27 15:30:15 -07:00

NixOS systems

These nixos configurations and flakes configure all of my systems.

The contents of this repository are organized as follows:

  • systems: These are complete nix modules for configuring specific systems. Unforutnately they're not "role based" systems, but explicit systems. I'd like to change that.
  • images: This directory contains a flake for building SD card images. Ideally, SD card images could also be complete systems e.g. for building a pi sd card. However, cross-compiling issues have prevented me from doing so. For now, sd card images are phase 1 in and two-phase install process.

Systems

homepi

This pi is at my house in Florida.

roampi

This pi is in Roamy McRoamerson.

z1

This is my primary System76 system.

Installing

z1

  • Boot into a NixOS install USB stick/CD/DVD. This can be an official image, or one generated by the flake in images.
  • At the install terminal, run sudo -i
  • Make this directory available to your installer, either by putting it on a separate usb drive, separate disk, or cloning the repo to the installer ramdisk.
  • Open nixos-zfs-setup.sh and modify it to your liking, paying special attention to the DISK variable. This should match the disk on which NixOS will be installed. It is also the disk on which the esp is installed. !!IF THERE IS ALREADY AN OS ON DISK, IT WILL BE WIPED OUT IN THE NEXT STEP!!
  • nixos-generate-config --root /mnt
  • Run bash nixos-zfs-setup.sh
  • Add private keys corresponding with the public keys that encrypted the system's secrets to /mnt/root/.ssh
  • Copy our custom configs to where the installer will use them: cp -rf * /mnt/etc/nixos
  • cd /mnt/etc/nixos
  • See Rescue / Install help for how to connect to a wifi network
  • Install NixOS on the system: nixos-install --flake .#z1
  • umount -Rl /mnt && swapoff -a && zpool export -a && reboot

homepi

  • Boot into a NixOS install USB stick/CD/DVD. Directions for generating images is in images.
  • After boot, your pi system will connect to wifi and be available over ssh with the SSH key configured in images/systems/homepi/default.nix
  • SSH into the system: ssh pi@<IP ADDR>
  • Clone this repo onto the system / transfer it to the system via sftp/rsync/scp
  • Create an SSH key and encrypt secrets:
    • ssh-keygen -t rsa -b 4096 -C "code@adriano.fyi" -f ~/.ssh/id_rsa_homepi -P ""
    • In systems/homepi/secrets/secrets.nix, add the contents (cat ~/.ssh/id_rsa_homepi.pub) of the system's public key
    • Create a Tailscale auth key at: https://login.tailscale.com/admin/settings/keys
    • Add the Tailsclale auth key secret: agenix -e tailscale_key.age -i ~/.ssh/id_rsa_homepi
    • Add wifi network secrets. agenix -e wireless_networks.age -i ~/.ssh/id_rsa_homepi. Wifi network secrets are of the form NETWORK_NAME=<PRESHARED KEY>. Where NETWORK_NAME is the name that's used between the @ symbols in configuration.nix, e.g.
      "Home5536" = {
        psk = "@HOME5536_PSK@";
      };
    
  • Install the homepi flake: sudo nixos-rebuild --flake .#homepi switch

Rescue / Install help

Boot into the NixOS installer sd card/CD/DVD.

Wireless Networking

To get wireless networking, wpa_supplicant must be started.

systemctl start wpa_supplicant

After starting wpa_supplicant, start wpa_cli:

add_network
set_network 0 ssid "<YOUR SSID>"
set network 0 psk "<Your wifi password"
set network 0 key_mgmt WPA-PSK | NONE | <WHATEVER TYPE YOUR NETWORK USES>
enable_network 0