about summary refs log tree commit diff
path: root/pkgs/build-support/rust/fetchcargo.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/rust/fetchcargo.nix')
-rw-r--r--pkgs/build-support/rust/fetchcargo.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix
index 9b3ba5303398..b8e55606473d 100644
--- a/pkgs/build-support/rust/fetchcargo.nix
+++ b/pkgs/build-support/rust/fetchcargo.nix
@@ -22,9 +22,15 @@ stdenv.mkDerivation {
     export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
     export CARGO_HOME=$(mktemp -d cargo-home.XXX)
 
-    cargo vendor
+    cargo vendor --locked | tee result.txt
 
-    cp -ar vendor $out
+    mkdir $out
+
+    # keep the outputted cargo config but remove the target directory.
+    # the target directory should be $out but that should change the sha256
+    cat result.txt | sed "s|directory = \".*|directory = \"REPLACEME\"|" > $out/.config
+
+    cp -ar vendor/* $out/
   '';
 
   outputHashAlgo = "sha256";