doc/rust: pass cargoRoot to fetcher in example

(cherry picked from commit 8e87675994)
This commit is contained in:
TomaSajt 2025-03-09 19:59:12 +01:00
parent eb33925219
commit 0124e5d8ed
No known key found for this signature in database
GPG key ID: F011163C050122A1

View file

@ -605,8 +605,8 @@ In some projects, the Rust crate is not in the main Python source
directory. In such cases, the `cargoRoot` attribute can be used to
specify the crate's directory relative to `sourceRoot`. In the
following example, the crate is in `src/rust`, as specified in the
`cargoRoot` attribute. Note that we also need to specify the correct
path for `fetchCargoVendor`.
`cargoRoot` attribute. Note that we also need to pass in `cargoRoot`
to `fetchCargoVendor`.
```nix
{
@ -627,8 +627,12 @@ buildPythonPackage rec {
};
cargoDeps = rustPlatform.fetchCargoVendor {
inherit pname version src;
sourceRoot = "${pname}-${version}/${cargoRoot}";
inherit
pname
version
src
cargoRoot
;
hash = "sha256-ctUt8maCjnGddKPf+Ii++wKsAXA1h+JM6zKQNXXwJqQ=";
};