This is mostly a reminder for myself how to do it, because the documentation non the nix side is pretty sparse.
What I want to do is to build imag on a remote server using nix 2.0 features - nix remote builds.
Here are the steps I did for achieving that goal:
- build the
cargo generate-lockfor the imag workspace
- generate a
carnix --standalone --src . --output build.nix Cargo.lock
- monkey-patching the generated nix file because
carnixgenerates wrong pathes for the
build.rsfile in the nix expressions. I did that with a simple substitude pattern in vim:
- ensure the remote machine has nix 2.0
NIX_REMOTE=ssh-ng://user@host nix build -f ./build.nix imag_0_7_0to build imag on the remote machine.
Unfortunately, because the generated expressions do not use
rustc compiler directly, the build fails because I need the
CARGO_PKG_VERSION environment variables which are
set by cargo during the build.
carnix gets support for automatically adding those variables to the
build soonish, so I can build imag completely remote.