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

Pass CARGO_HOME on more invocations of cargo #61194

Closed
wants to merge 1 commit into from

Conversation

glasserc
Copy link
Contributor

@glasserc glasserc commented May 9, 2019

Fixes #61192.

Motivation for this change

Although this failure only occurs when using Cargo nightly, which isn't actually packaged here yet, this will eventually become a problem when nightly becomes stable.

I'm not really sure that this is the right place for this change. Is the existing absence of CARGO_HOME meant to flush out reproducibility failures when cargo tries to download a package? Or was it just because previously cargo didn't need to do anything in the build or test phases so it wasn't necessary?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@samlich
Copy link
Contributor

samlich commented May 31, 2019

I lost the log, but I had an issue compiling cargo with it set to $(pwd) as it used two different directories at different times, using $TMPDIR worked.
It also needs to be set for the rustc compilation.

--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -54,6 +54,8 @@ in stdenv.mkDerivation rec {
   # Increase codegen units to introduce parallelism within the compiler.
   RUSTFLAGS = "-Ccodegen-units=10";

+  # Cargo creates locks in `$CARGO_HOME/.cargo/.package-cache`, which must be writeable
+  CARGO_HOME = "$TMPDIR";
+
   # We need rust to build rust. If we don't provide it, configure will try to download it.

@FRidh
Copy link
Member

FRidh commented Jun 18, 2019

Please cc the Nixpkgs maintainers of cargo/rust in order to get this further.

@glasserc
Copy link
Contributor Author

glasserc commented Aug 2, 2019

I'm not sure who that is, but based on commit history, maybe it's @Mic92 or @Ericson2314 ?

@samlich
Copy link
Contributor

samlich commented Aug 2, 2019

btw this may be fixed by rust-lang/cargo#7149
If it doesn't, I think they do want to fix it upstream.

@@ -121,6 +122,7 @@ in stdenv.mkDerivation (args // {
checkPhase = args.checkPhase or ''
runHook preCheck
echo "Running cargo test"
export CARGO_HOME=$(pwd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather set it to $TMPDIR though. And it only needs to be set once - maybe in the configurePhase?

@samlich
Copy link
Contributor

samlich commented Aug 8, 2019

With nightly 2019-08-06 built with beta 2019-08-06, I no longer have this issue.

@Mic92 Mic92 mentioned this pull request Aug 14, 2019
10 tasks
@Mic92
Copy link
Member

Mic92 commented Aug 16, 2019

This should be covered by the following commit: 3372343

@glasserc
Copy link
Contributor Author

I think so too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing to build packages with Cargo nightly
4 participants