Skip to content

Commit

Permalink
feat(pendulum): Use importCargoLock without downloading from GitHub
Browse files Browse the repository at this point in the history
Previous approach of patching the source prior to build always results
in some hash mismatch. So here we just use a drop-in Cargo.lock file,
or rather what it would have looked like had the version been set
correctly.

See: #1739
  • Loading branch information
bow authored and cpcloud committed Sep 27, 2024
1 parent e60cb1e commit 28ae7a2
Show file tree
Hide file tree
Showing 2 changed files with 321 additions and 20 deletions.
23 changes: 3 additions & 20 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2131,28 +2131,11 @@ lib.composeManyExtensions [
if lib.versionOlder old.version "3"
then { }
else
let
githubHash = {
"3.0.0" = "sha256-v0kp8dklvDeC7zdTDOpIbpuj13aGub+oCaYz2ytkEpI=";
}.${old.version} or lib.fakeHash;

src = pkgs.fetchFromGitHub {
owner = "sdispater";
repo = "pendulum";
rev = old.version;
sha256 = githubHash;
};
in
lib.optionalAttrs (!old.src.isWheel or false) (
rec {
{
cargoRoot = "rust";
# NOTE: rustPlatform.importCargoLock would require prePatch on Cargo.lock
# since that file has its version value set to "3.0.0-beta-1"
# instead of the "3.0.0" used in the Python pyproject.toml, and
# this would cause an integrity check error when building.
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
src = "${src.out}/${cargoRoot}";
sha256 = "sha256-nhQM7QChMay/EQuAO9PSRguXq13Mfwkk5bNTn/8Fzlc=";
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = ./pendulum/3.0.0-Cargo.lock;
};
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
pkgs.rustPlatform.cargoSetupHook
Expand Down
318 changes: 318 additions & 0 deletions overrides/pendulum/3.0.0-Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 28ae7a2

Please sign in to comment.