summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2020-06-05 08:10:53 +0100
committerJörg Thalheim <joerg@thalheim.io>2020-06-05 10:41:46 +0100
commitf0396574ab32b2d0b02469e7c2b1446623344f09 (patch)
tree5064c6fd5356a792e9ec64a48c9b97f246c3122b /doc
parentfb6c3cee64826494973fdf4eb362eecac3fd8a11 (diff)
downloadnixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar.gz
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar.bz2
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar.lz
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar.xz
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.tar.zst
nixpkgs-f0396574ab32b2d0b02469e7c2b1446623344f09.zip
buildRustPackage: add documentation on how to create cargo.lock patches
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 cec3373cbee..f56bc5285b9 100644
--- a/doc/languages-frameworks/rust.section.md
+++ b/doc/languages-frameworks/rust.section.md
@@ -75,6 +75,24 @@ pkgs.rustPlatform.buildRustPackage {
 }
 ```
 
+### 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