Hello, everyone! I've been using nix mostly as a package manager with home-manager, and today I had a dillemma: cross compiling.
On trying to do so it gives you the helpful advice to do rustup target add
, which prompted me to delete all my rust packages from home manager and just install rustup.
https://emacs.ch/@crmsnbleyd/111928501351116776
Have any of you ever done cross compilation with rust without resorting to this?
There is a thing called flakebox which is supposedly offering this. Maybe worth a try. They have a tutorial including cross-compilation here: https://github.com/rustshop/flakebox/blob/master/docs/building-new-project.md
What are you cross-compiling to?
See
They both use https://crane.dev/ and in the first repo you can see rust-toolchain.toml
containing the wasm target which is what Nix uses.
https://crane.dev/examples/cross-rust-overlay.html
Flakebox uses crane; I'd recommend fiddling with crane first.
Srid said:
What are you cross-compiling to?
from Darwin to x86_64-unknown-linux-gnu
You can try it with https://crane.dev/examples/cross-rust-overlay.html
I also just came across this. Looks interesting, but don't know much about it:
https://old.reddit.com/r/rust/comments/11okj5w/rust_crosscompilation_without_struggles_by_using/
With it, you can build Linux binaries and docker images from the MacOS hosts without any virtual machines.
Unlike crane, this uses whatever build infra nixpkgs provides. As an interesting aside, the example uses #flake-parts
Drew Jose has marked this topic as resolved.
Drew Jose has marked this topic as unresolved.
Last updated: Nov 15 2024 at 12:33 UTC