Skip to content

Commit

Permalink
feat(pendulum): Add version >=3.0.0 override with rust build hook
Browse files Browse the repository at this point in the history
  • Loading branch information
bow authored and cheriimoya committed Oct 2, 2024
1 parent 2a8e50f commit 8d45011
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,48 @@ lib.composeManyExtensions [
}
);

pendulum = prev.pendulum.overridePythonAttrs (
old: (
# NOTE: Versions <3.0.0 is pure Python and is not PEP-517 compliant,
# which means they can not be built using recent Poetry versions.
if lib.versionOlder old.version "3"
then prev.pendulum
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-6cL3GXtGnmD/nruOykBRqNwXnB74sr9EEFFT0fXamp0=";
};
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
pkgs.rustPlatform.cargoSetupHook
pkgs.rustPlatform.maturinBuildHook
];
buildInputs = old.buildInputs or [ ] ++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
];
}
)
)
);

pikepdf = prev.pikepdf.overridePythonAttrs (
old: {
buildInputs = old.buildInputs or [ ] ++ [ pkgs.qpdf final.pybind11 ];
Expand Down

0 comments on commit 8d45011

Please sign in to comment.