about summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2023-03-17 15:53:44 +0100
committerYureka <yuka@yuka.dev>2023-03-26 01:52:03 +0100
commit4329de1264ecb7cca8709dc1984b86beb11bcc4e (patch)
tree3a9a1d83fb7427d3a2bad775e095559a2a042a0b /pkgs/build-support/rust
parent34aef860a553cb684e942754c269e95cebf2062e (diff)
rustPlatform.fetchCargoTarball: fail on git dependencies
The reason is that we can not expect the extended logic run on git
dependencies starting from Cargo 1.68 to be reproducible in future
 versions, and thus the output hash would not be sufficiently stable.
https://github.com/rust-lang/cargo/pull/11414
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r--pkgs/build-support/rust/fetch-cargo-tarball/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix
index 36ab931697410..adbfe98d81039 100644
--- a/pkgs/build-support/rust/fetch-cargo-tarball/default.nix
+++ b/pkgs/build-support/rust/fetch-cargo-tarball/default.nix
@@ -76,6 +76,17 @@ in stdenv.mkDerivation ({
     # Override the `http.cainfo` option usually specified in `.cargo/config`.
     export CARGO_HTTP_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
 
+    if grep '^source = "git' Cargo.lock; then
+        echo
+        echo "ERROR: The Cargo.lock contains git dependencies"
+        echo
+        echo "This is currently not supported in the fixed-output derivation fetcher."
+        echo "Use cargoLock.lockFile / importCargoLock instead."
+        echo
+
+        exit 1
+    fi
+
     cargo vendor $name --respect-source-config | cargo-vendor-normalise > $CARGO_CONFIG
 
     # Create an empty vendor directory when there is no dependency to vendor