The host names should match the name of the nixosConfiguration output from your flake. If they don’t I think you can specify like, --target-host .#some-machine
Remote sudo avoids having to SSH as root.
Bonus tip: Having Tailscale on every machine makes this work reliably from anywhere, network speed as the limit.
On the topic of build times, it took me too long to learn that nixos-rebuild supports remote build workers and targets.
For example, if I am editing on my laptop, want to build on my desktop, and apply the build to my file server, then I’d run…
me@laptop$ nixos-rebuild test \ --flake ~/wherever-it-lives \ --build-host desktop \ --target-host file-server \ --use-remote-sudo
The host names should match the name of the nixosConfiguration output from your flake. If they don’t I think you can specify like,
--target-host .#some-machine
Remote sudo avoids having to SSH as root.
Bonus tip: Having Tailscale on every machine makes this work reliably from anywhere, network speed as the limit.