mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
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`
|
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
|
approach will not work by default. In this case, you can set `useFetchCargoVendor = true`
|
||||||
to nixpkgs and continue with the next section for specifying the options of the `cargoLock`
|
to use an improved fetcher that supports handling `git` dependencies.
|
||||||
section.
|
|
||||||
|
|
||||||
|
```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
|
Both types of hashes are permitted when contributing to nixpkgs. The
|
||||||
Cargo hash is obtained by inserting a fake checksum into 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
|
the `Cargo.lock`/`Cargo.toml` files need to be patched before
|
||||||
vendoring.
|
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
|
If a `Cargo.lock` file is available, you can alternatively use the
|
||||||
`importCargoLock` function. In contrast to `fetchCargoTarball`, this
|
`importCargoLock` function. In contrast to `fetchCargoTarball`, this
|
||||||
function does not require a hash (unless git dependencies are used)
|
function does not require a hash (unless git dependencies are used)
|
||||||
|
@ -120,8 +120,9 @@ stdenv.mkDerivation (
|
|||||||
echo
|
echo
|
||||||
echo "ERROR: The Cargo.lock contains git dependencies"
|
echo "ERROR: The Cargo.lock contains git dependencies"
|
||||||
echo
|
echo
|
||||||
echo "This is currently not supported in the fixed-output derivation fetcher."
|
echo "This is not supported in the default fixed-output derivation fetcher."
|
||||||
echo "Use cargoLock.lockFile / importCargoLock instead."
|
echo "Set \`useFetchCargoVendor = true\` / use fetchCargoVendor"
|
||||||
|
echo "or use cargoLock.lockFile / importCargoLock instead."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user