Nixos-rebuild: target-host not reachable from build-host

I have the following situation. I want to build an nixos configuration for my raspberry pi.
Since my laptop is kind of weak I wanted to use my server as a build-host. Now, my pi is on my local network it is not reachable by the build-host. Is there are way that my local machine that invokes the nixos-rebuild command act as a kind of proxy? If not, how can I achieve this?

My command that I invoke:

nixos-rebuild switch --flake .\?submodules=1#EppdPi --target-host 192.168.178.102 --build-host BUILDHOST_URL  --use-remote-sudo --use-substitutes

Result:

ssh -o ControlMaster=auto -o ControlPath=/tmp/nix-shell.PO1Tic/nixos-rebuild.nCPFnh/ssh-%n -o ControlPersist=60 BUILDHOST_URL nix-copy-closure -v -s --to 192.168.178.102 /nix/store/5c4m9bxhsx6aj82gnpn2mngnj0k8avg2-nixos-system-EppdPi-24.11.20250120.ae584d9

ssh: connect to host 192.168.178.102 port 22: Connection timed out

You could nixos-rebuild build --build-host ... followed by a nixos-rebuild switch --target-host ....

2 Likes

Yes! this is working.

Thank you.