You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently import-cargo just builds a derivation full of vendored source code.
It'd be quite amazing if it could build a set of derivations that compile each dependency separately (in order to avoid recompiling things unnecessarily).
Currently cargo (nightly) provides --build-plan, which outputs a plan full of the relevant rustc calls/args/env variables and the dependency tree. It seems like it should be possible to use this to create the set of nix derivations (with a little bit of rewriting of paths and -L inputs etc.)
A snip of a bit of the --build-plan output for a single dependency in the middle of my tree:
Sorry for the late answer. The main issue with that solution (apart from working on Nightly), is features: currently, buildRustCrate translates crate features into Nix, which means that one can override features from Nix. Also, some features depend on the platform, and Nix can detect that automatically, which the build-plan cannot do.
@P-E-Meunier Thanks for the response; fair points. The reason I switched off of buildRustCrate some months ago was actually because of the nix expression evaluation time (on a very complex Rust project with lots of deps) was unbearable, possibly due to the overridability, which I didn't need. I still like the idea of using a flake here to build the relevant set of derivations and I'm curious how to make it flexible enough for people.
Currently
import-cargo
just builds a derivation full of vendored source code.It'd be quite amazing if it could build a set of derivations that compile each dependency separately (in order to avoid recompiling things unnecessarily).
Currently
cargo
(nightly) provides--build-plan
, which outputs a plan full of the relevantrustc
calls/args/env variables and the dependency tree. It seems like it should be possible to use this to create the set of nix derivations (with a little bit of rewriting of paths and -L inputs etc.)A snip of a bit of the
--build-plan
output for a single dependency in the middle of my tree:cc @mstone @copumpkin @P-E-Meunier
The text was updated successfully, but these errors were encountered: