···143143144144`shizuri` and `odin` are configured as trusted `x86_64-linux` Nix remote builders. Client hosts import `modules/nix-remote-builders.nix` through `common.nix`, so NixOS hosts in this flake will try to use both builders except for the current host itself.
145145146146-Builder access uses the `nixremote` user declared in `modules/nix-builder.nix`. Add client public keys to `users.users.nixremote.openssh.authorizedKeys.keys` before rebuilding the build hosts.
146146+Builder access uses the `nixremote` user declared in `modules/nix-builder.nix`. Client private keys live at `/root/.ssh/nix-remote-builder`; their public keys are declared in `users.users.nixremote.openssh.authorizedKeys.keys`.
147147148148-#### Set up a new client
148148+#### Add client access
149149150150-Generate or install the client key at the path expected by `modules/nix-remote-builders.nix`:
150150+On the client, generate the key and print its public half:
151151152152```bash
153153sudo install -d -m 700 /root/.ssh
154154sudo ssh-keygen -t ed25519 -N '' -C "nix-remote-builder@$(hostname)" -f /root/.ssh/nix-remote-builder
155155+sudo cat /root/.ssh/nix-remote-builder.pub
155156```
156157157157-Copy the public key:
158158+Add the public key to `modules/nix-builder.nix`, then rebuild the builders once:
158159159160```bash
160160-sudo cat /root/.ssh/nix-remote-builder.pub
161161+sudo nixos-rebuild switch --flake .#shizuri
162162+sudo nixos-rebuild switch --flake .#odin
161163```
162164163163-Add that public key to `users.users.nixremote.openssh.authorizedKeys.keys` in `modules/nix-builder.nix`, then rebuild each builder:
165165+Trust builder host keys on the client:
164166165167```bash
166166-sudo nixos-rebuild switch --flake .#shizuri
167167-sudo nixos-rebuild switch --flake .#odin
168168+sudo ssh-keyscan -H shizuri odin | sudo tee -a /root/.ssh/known_hosts >/dev/null
168169```
169170170170-On the client, trust the builder host keys and rebuild the client:
171171+#### NixOS clients
172172+173173+NixOS hosts in this flake already import the remote builder config through `common.nix`. After adding client access, rebuild the client:
171174172175```bash
173173-sudo ssh-keyscan -H shizuri odin | sudo tee -a /root/.ssh/known_hosts >/dev/null
174176sudo nixos-rebuild switch --flake .#<client-hostname>
175177```
176178177177-Test builder access:
179179+Smoke test:
178180179181```bash
180182sudo ssh -i /root/.ssh/nix-remote-builder nixremote@shizuri nix-store --version
···182184sudo nix build nixpkgs#hello --max-jobs 0 -L
183185```
184186187187+#### Standalone Home Manager clients
188188+189189+Standalone Home Manager uses the host's Nix daemon. After adding client access, put the builder list in `/etc/nix/nix.conf`:
190190+191191+```conf
192192+experimental-features = nix-command flakes
193193+builders-use-substitutes = true
194194+builders = ssh-ng://nixremote@shizuri x86_64-linux /root/.ssh/nix-remote-builder 24 4 nixos-test,benchmark,big-parallel,kvm - ; ssh-ng://nixremote@odin x86_64-linux /root/.ssh/nix-remote-builder 24 4 nixos-test,benchmark,big-parallel,kvm -
195195+```
196196+197197+Restart the daemon and run Home Manager:
198198+199199+```bash
200200+sudo systemctl restart nix-daemon
201201+home-manager switch --flake .#noah
202202+```
203203+204204+Linux builders cannot build normal Darwin outputs; `homeConfigurations.noah-aleister` needs Darwin builders.
205205+185206#### Set up a new build host
186207187187-Import the builder module from the new host configuration:
208208+Import `modules/nix-builder.nix` from the new host configuration:
188209189210```nix
190211{
···194215}
195216```
196217197197-Add the host to the `builders` list in `modules/nix-remote-builders.nix`:
198198-199199-```nix
200200-{
201201- hostName = "new-builder";
202202- sshUser = "nixremote";
203203- sshKey = "/root/.ssh/nix-remote-builder";
204204- system = "x86_64-linux";
205205- protocol = "ssh-ng";
206206- maxJobs = 24;
207207- speedFactor = 4;
208208- supportedFeatures = [
209209- "nixos-test"
210210- "benchmark"
211211- "big-parallel"
212212- "kvm"
213213- ];
214214-}
215215-```
218218+Add a matching entry to the `builders` list in `modules/nix-remote-builders.nix`.
216219217220Rebuild the new builder first, then rebuild each client that should use it:
218221