Skip to content
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

createRustPackage fails for packages which use the patch feature in Cargo.toml #72859

Open
jamii opened this issue Nov 5, 2019 · 9 comments
Open
Labels
0.kind: bug Something is broken 6.topic: rust

Comments

@jamii
Copy link
Contributor

jamii commented Nov 5, 2019

Describe the bug

When there is a [patch] section in Cargo.toml, calling cargo build --frozen will attempt to redownload the patch and then fail because of the --frozen.

This is arguably a cargo bug, because it appears that the patch is already vendored correctly.

To Reproduce

Minimal repro at https://github.com/jamii/rust-nix-patch.

jamie@machine:~/rust-nix-patch$ nix-build default.nix 
these derivations will be built:
  /nix/store/ghx01p7n275i8kalqvcbz3mqpqwiz911-rust-nix-patch.drv
building '/nix/store/ghx01p7n275i8kalqvcbz3mqpqwiz911-rust-nix-patch.drv'...
unpacking sources
unpacking source archive /nix/store/ya7anvmgxgj38c6lhshi5nf79xqm0l9n-source
source root is source
unpacking source archive /nix/store/99w9c3z1nwgw85d6drn38926h89k19m9-rust-nix-patch-vendor
patching sources
configuring
building
++ env CC_x86_64-unknown-linux-gnu=/nix/store/qy6rb8p4fg1p3xfw0g6wz6iirxbdxizp-gcc-wrapper-8.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/qy6rb8p4fg1p3xfw0g6wz6iirxbdxizp-gcc-wrapper-8.3.0/bin/c++ CC_x86_64-unknown-linux-gnu=/nix/store/qy6rb8p4fg1p3xfw0g6wz6iirxbdxizp-gcc-wrapper-8.3.0/bin/cc CXX_x86_64-unknown-linux-gnu=/nix/store/qy6rb8p4fg1p3xfw0g6wz6iirxbdxizp-gcc-wrapper-8.3.0/bin/c++ cargo build --release --target x86_64-unknown-linux-gnu --frozen
    Updating git repository `https://github.com/jamii/regex.git`
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to load source for a dependency on `regex`

Caused by:
  Unable to update https://github.com/jamii/regex.git

Caused by:
  failed to clone into: /build/git/db/regex-fac71ca280a2847b

Caused by:
  attempting to update a git repository, but --frozen was specified
builder for '/nix/store/ghx01p7n275i8kalqvcbz3mqpqwiz911-rust-nix-patch.drv' failed with exit code 101
error: build of '/nix/store/ghx01p7n275i8kalqvcbz3mqpqwiz911-rust-nix-patch.drv' failed

Metadata

jamie@machine:~$ nix run nixpkgs.nix-info -c nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.80, NixOS, 20.03pre197685.f35f0880f2c (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.1`
 - channels(jamie): `""`
 - channels(root): `"nixos-20.03pre197685.f35f0880f2c"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@jamii jamii added the 0.kind: bug Something is broken label Nov 5, 2019
@jamii
Copy link
Contributor Author

jamii commented Nov 7, 2019

rust-lang/cargo#5805 (comment) suggests that this is intentional behavior in cargo

@stale

This comment was marked as spam.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@aaronjanse
Copy link
Member

aaronjanse commented Jul 18, 2020

This is still important to me

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 18, 2020
@stale

This comment was marked as spam.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 14, 2021
@jamii
Copy link
Contributor Author

jamii commented Jan 20, 2021

The minimal repro above still does not work.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 20, 2021
@stale

This comment was marked as spam.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 20, 2021
@andrewbaxter
Copy link

Bump.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 3, 2022
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/fixing-the-polars-package-cargo-patch-frozen/22901/1

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/rust-packaging-issue-unable-to-fetch-git-dependencies-correctly/46547/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: rust
Projects
None yet
Development

No branches or pull requests

5 participants