mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 05:36:09 +03:00
downloadCargoPackageFromGit: take hash
instead of sha256
(#691)
This commit is contained in:
parent
5d6c16530f
commit
95b42093e5
@ -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
|
||||
|
12
docs/API.md
12
docs/API.md
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user