Remote build with output on remote

Consider this use case: I have a Nix flake which has a derivation output that is some docker image. I develop on a local machine and want to run the image on remote. Normally, I build the image locally and scp it to remote. The image is huge, and copying takes a while.

Is it possible to use the remote build feature to directly build this derivation on a remote machine, so I don’t have to scp the image to remote every time I change my code?

e.g.

nix build --impure .#mystery-image --builders ssh://$REMOTE -o ???

nix build –eval-store auto –store ssh-ng://myhost .#myimage

1 Like