From 09552b21ba496e1bc349bbaa8bf18966730069b4 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Sun, 6 Mar 2022 17:19:23 +0300 Subject: [PATCH] fix(rust): dont use hardcoded CARGO_HOME to /build --- src/builders/rust/build-rust-package/default.nix | 3 +-- src/builders/rust/crane/default.nix | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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);