-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support renamed crates #22
Comments
I'd like to try and provide something but i'm trying to first understand correctly what is going on in this concrete case:
Looking at the output of
Looking at the Cargo.toml of
TL;DR: EDIT: So actually, while a carnix based build clearly trips on rand what I am seeing is a failed build because of Cargo invoked rustc:
Carnix invoked rustc:
Build Error:
So EDIT 2: @kolloch I think the problem that i was seeing with diff --git a/Cargo.nix b/Cargo.nix
index b47b41f..68f72d0 100644
--- a/Cargo.nix
+++ b/Cargo.nix
@@ -1009,10 +1009,7 @@ rec {
dependencies = {
"crc32fast" = "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)";
"libc" = "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)";
- "miniz_oxide" = {
- packageId = "miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)";
- target = ((target."arch" == "wasm32") && (!(target."os" == "emscripten")));
- };
+ "miniz_oxide" = "miniz_oxide 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)";
};
features = {
"default" = [ "miniz-sys" ]; Without the patch |
Backing off a bit from the concrete problem I am looking at i'd like to ask: buildRustCrate renaming semantics
What logic do you reckon this should lead to? I guess: Fetch This could be done in |
I created https://github.com/gilligan/rs-nix-test just to have a minimal reproducible test case. I'll start looking at both the code of |
@gilligan thanks for making the minimal example. It turns out to be fairly simple to change the generated Nix to support the replacement. The basic idea:
The diff against https://gist.github.com/danieldk/a3c2a091134fd75db079a37c3c486604 The build now fails for another reason, but at least rustc is called with the right |
Ok, I think this is a dead end. The error is:
I think the problem is that
and
So, the
However, |
@danieldk yes I think so as well. My thought the other day was to have crate2Nix pass a “renames” argument to buildRustCrate but i haven’t had the time to look into this again since. |
I got it working. Patch against https://gist.github.com/danieldk/9d78945828dc5d0bcebc0e0b913d5211 I still have to clean it up a little. |
I made a draft PR with the The updated changes in the generated https://gist.github.com/danieldk/2984e65c71e7c0867e528a02194562aa |
Awesome! Let's wait until support lands in nixos. Thank you! |
The information about package renames is exposed by
cargo metadata
and should therefore be easy to use. Unfortunately,buildRustCrate
has no straight-forward support for this.User docs for renamed crates.
Help wanted: If someone could make it work by hand-coding a minimalistic nix build file, that would be much appreciated. I think that we can hack our way to success even with the current
buildRustCrate
but explicit support for crate renames inbuildRustCrate
would be better. Both is fine for now.The text was updated successfully, but these errors were encountered: