No description
| images | ||
| systems | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
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.shand modify it to your liking, paying special attention to theDISKvariable. This should match the disk on which NixOS will be installed. It is also the disk on which theespis installed. !!IF THERE IS ALREADY AN OS ONDISK, 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 helpfor 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 formNETWORK_NAME=<PRESHARED KEY>. WhereNETWORK_NAMEis the name that's used between the@symbols inconfiguration.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