docs: mention fetchCargoVendor
This commit is contained in:
parent
37ce479c7b
commit
66855adbbf
@ -64,10 +64,18 @@ hash using `nix-hash --to-sri --type sha256 "<original sha256>"`.
|
||||
```
|
||||
|
||||
Exception: If the application has cargo `git` dependencies, the `cargoHash`
|
||||
approach will not work, and you will need to copy the `Cargo.lock` file of the application
|
||||
to nixpkgs and continue with the next section for specifying the options of the `cargoLock`
|
||||
section.
|
||||
approach will not work by default. In this case, you can set `useFetchCargoVendor = true`
|
||||
to use an improved fetcher that supports handling `git` dependencies.
|
||||
|
||||
```nix
|
||||
{
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-RqPVFovDaD2rW31HyETJfQ0qVwFxoGEvqkIgag3H6KU=";
|
||||
}
|
||||
```
|
||||
|
||||
If this method still does not work, you can resort to copying the `Cargo.lock` file into nixpkgs
|
||||
and importing it as described in the [next section](#importing-a-cargo.lock-file).
|
||||
|
||||
Both types of hashes are permitted when contributing to nixpkgs. The
|
||||
Cargo hash is obtained by inserting a fake checksum into the
|
||||
@ -462,6 +470,17 @@ also be used:
|
||||
the `Cargo.lock`/`Cargo.toml` files need to be patched before
|
||||
vendoring.
|
||||
|
||||
In case the lockfile contains cargo `git` dependencies, you can use
|
||||
`fetchCargoVendor` instead.
|
||||
```nix
|
||||
{
|
||||
cargoDeps = rustPlatform.fetchCargoVendor {
|
||||
inherit src;
|
||||
hash = "sha256-RqPVFovDaD2rW31HyETJfQ0qVwFxoGEvqkIgag3H6KU=";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
If a `Cargo.lock` file is available, you can alternatively use the
|
||||
`importCargoLock` function. In contrast to `fetchCargoTarball`, this
|
||||
function does not require a hash (unless git dependencies are used)
|
||||
|
@ -120,8 +120,9 @@ stdenv.mkDerivation (
|
||||
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 "This is not supported in the default fixed-output derivation fetcher."
|
||||
echo "Set \`useFetchCargoVendor = true\` / use fetchCargoVendor"
|
||||
echo "or use cargoLock.lockFile / importCargoLock instead."
|
||||
echo
|
||||
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user