downloadCargoPackageFromGit: take hash instead of sha256 (#691)

This commit is contained in:
Ivan Petkov 2024-08-29 15:47:52 -07:00 committed by GitHub
parent 5d6c16530f
commit 95b42093e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 10 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* **Breaking** (technically): `buildPackage` no longer adds `jq` to
`nativeBuildInputs` as doing so can result in rebuilding any `*-sys` crates
which rely on `PKG_CONFIG_PATH` remaining stable
* **Breaking**: `downloadCargoPackageFromGit` now takes `hash` instead of
`sha256` when specifying an output hash for the download
* `installFromCargoBuildLogHook` no longer assumes or requires that `jq` is
available on `$PATH` and will instead directly reference `pkgs.jq`
* `downloadCargoPackageFromGit` will now set `fetchLFS = true` when fetching git

View File

@ -1369,8 +1369,8 @@ At least one of the above attributes must be specified, or an error will be
raised during evaluation.
#### Optional attributes
* `outputHashes`: a mapping of package-source to the sha256 of the (unpacked)
download. Useful for supporting fully offline evaluations.
* `outputHashes`: a mapping of package-source to the `hash` attribute of the
(unpacked) download. Useful for supporting fully offline evaluations.
- Default value: `[]`
* `overrideVendorCargoPackage`: a function that will be called on every crate
vendored from a cargo registry, which allows for modifying the derivation
@ -1441,8 +1441,8 @@ access.
`Cargo.lock` file (parsed via `builtins.fromTOML`)
#### Optional attributes
* `outputHashes`: a mapping of package-source to the sha256 of the (unpacked)
download. Useful for supporting fully offline evaluations.
* `outputHashes`: a mapping of package-source to the `hash` attribute of the
(unpacked) download. Useful for supporting fully offline evaluations.
- Default value: `[]`
* `overrideVendorGitCheckout`: a function that will be called on every unique
checkout vendored from a git repository, which allows for modifying the
@ -1491,8 +1491,8 @@ the vendored directories (i.e. this configuration can be appended to the
* `cargoLockParsedList`: a list of attrsets representing the parsed contents of
different `Cargo.lock` files to be included while vendoring.
- Default value: `[]`
* `outputHashes`: a mapping of package-source to the sha256 of the (unpacked)
download. Useful for supporting fully offline evaluations.
* `outputHashes`: a mapping of package-source to the `hash` attribute of the
(unpacked) download. Useful for supporting fully offline evaluations.
- Default value: `[]`
* `overrideVendorCargoPackage`: a function that will be called on every crate
vendored from a cargo registry, which allows for modifying the derivation

View File

@ -13,13 +13,13 @@ in
{ git
, rev
, ref ? null
, sha256 ? null
, hash ? null
, allRefs ? ref == null
}:
let
maybeRef = lib.optionalAttrs (ref != null) { inherit ref; };
repo =
if sha256 == null then
if hash == null then
builtins.fetchGit
(maybeRef // {
inherit allRefs rev;
@ -28,7 +28,7 @@ let
})
else
fetchgit {
inherit rev sha256;
inherit rev hash;
url = git;
fetchSubmodules = true;
fetchLFS = true;

View File

@ -100,7 +100,7 @@ let
inherit (p) git;
inherit ref;
rev = p.lockedRev;
sha256 = outputHashes.${p.package.source} or (lib.warnIf
hash = outputHashes.${p.package.source} or (lib.warnIf
(outputHashes != { })
"No output hash provided for ${p.package.source}"
null