diff --git a/src/builders/rust/build-rust-package/default.nix b/src/builders/rust/build-rust-package/default.nix index e096866f..fc93013f 100644 --- a/src/builders/rust/build-rust-package/default.nix +++ b/src/builders/rust/build-rust-package/default.nix @@ -40,10 +40,9 @@ let cargoVendorDir = "../nix-vendor"; - CARGO_HOME = "/build/.cargo-home"; - postUnpack = '' ln -s ${vendorDir} ./nix-vendor + export CARGO_HOME=$(pwd)/.cargo_home ''; preConfigure = '' diff --git a/src/builders/rust/crane/default.nix b/src/builders/rust/crane/default.nix index 572f6463..4a0cee26 100644 --- a/src/builders/rust/crane/default.nix +++ b/src/builders/rust/crane/default.nix @@ -32,15 +32,16 @@ let let src = utils.getRootSource pname version; cargoVendorDir = vendoring.vendorDependencies pname version; + postUnpack = '' + export CARGO_HOME=$(pwd)/.cargo_home + ''; preConfigure = '' ${vendoring.writeGitVendorEntries "nix-sources"} ''; # The deps-only derivation will use this as a prefix to the `pname` depsNameSuffix = "-deps"; - # Set CARGO_HOME to /build because we write our .cargo/config there - CARGO_HOME = "/build/.cargo_home"; - common = {inherit pname version src cargoVendorDir preConfigure CARGO_HOME;}; + common = {inherit pname version src cargoVendorDir preConfigure postUnpack;}; depsArgs = common // { pnameSuffix = depsNameSuffix; }; deps = produceDerivation "${pname}${depsNameSuffix}" (crane.buildDepsOnly depsArgs);