summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2020-06-05 19:42:16 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2020-06-05 19:42:16 +0200
commit1c68570ab297a96861ec87034ff9ef155e23b0a4 (patch)
treea6785ac0ec23ec3b4686ec4c11b0cc4590320c80 /doc
parent462aa777dfbb45829321dead7749382e3d551e8c (diff)
parent43f71029cc6b18c1b4db4d01b35dbb30425c2f4e (diff)
downloadnixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar.gz
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar.bz2
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar.lz
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar.xz
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.tar.zst
nixpkgs-1c68570ab297a96861ec87034ff9ef155e23b0a4.zip
Merge staging-next into staging
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/rust.section.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md
index 7e5cff8ff60..ec418c56335 100644
--- a/doc/languages-frameworks/rust.section.md
+++ b/doc/languages-frameworks/rust.section.md
@@ -141,6 +141,24 @@ In these cases, it's recommended to override the `buildPhase`/`installPhase`/`ch
 
 Otherwise, some steps may fail because of the modified directory structure of `target/`.
 
+### Building a crate with an absent or out-of-date Cargo.lock file
+
+`buildRustPackage` needs a `Cargo.lock` file to get all dependencies in the
+source code in a reproducible way. If it is missing or out-of-date one can use
+the `cargoPatches` attribute to update or add it.
+
+```
+{ lib, rustPlatform, fetchFromGitHub }:
+
+rustPlatform.buildRustPackage rec {
+  (...)
+  cargoPatches = [
+    # a patch file to add/update Cargo.lock in the source code
+    ./add-Cargo.lock.patch
+  ];
+}
+```
+
 ## Compiling Rust crates using Nix instead of Cargo
 
 ### Simple operation