···3030To add a new device to this configuration, follow these steps:
313132321. **Create Host Configuration**:
3333-3433 - Duplicate an existing host directory within `hosts/` and rename it to the new device's hostname.
3534 - Modify the `default.nix` and other relevant Nix modules (e.g., `disko.nix`, `hardware.nix`, `home.nix`) to match the new device's specifications.
363537361. **Update `flake.nix`**:
3838-3937 - Add the new host to the `nixosConfigurations` section in `flake.nix`.
403841391. **(Optional) Configure Syncthing**:
4242-4340 - Generate Syncthing certificates and device ID:
4441 ```bash
4542 syncthing -generate="$HOSTNAME"
···4845 - Encrypt the `cert.pem` and `key.pem` using `agenix` and set them appropriately in the host configuration.
494650471. **Install NixOS**:
5151-5248 - Install NixOS on the new device using this flake. Note that secrets will not be available on the first boot without a valid SSH private key.
534954501. **Authorize SSH Key**:
5555-5651 - On a separate machine, copy the new system's public SSH key (`/etc/ssh/ssh_host_ed25519_key.pub`) to the upstream secrets repository (`secrets/publicKeys/root_$HOSTNAME.pub`).
575258531. **Rekey Secrets**:
5959-6054 - Add the new public key to upstream `secrets.nix`.
6155 - Rekey all secrets:
6256 ```bash
···6559 - Push the changes to the repository.
666067611. **Rebuild System**:
6868-6962 - On the new device, rebuild the system from the repository. Secrets will be automatically decrypted and available in `/run/agenix/` for NixOS and `$XDG_RUNTIME_DIR/agenix/` for users.
706371641. **(Optional) Configure User SSH Key**:
7272-7365 - Generate a new user SSH key and copy it to `secrets/publicKeys/$USER_$HOSTNAME.pub` to enable passwordless logins to other hosts.
74667567---