Skip to content

Commit

Permalink
python312Packages.primp: 0.6.5 -> 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Feb 9, 2025
1 parent 00d32b5 commit dc7f6c2
Showing 1 changed file with 48 additions and 7 deletions.
55 changes: 48 additions & 7 deletions pkgs/development/python-modules/primp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,73 @@
patchelf,
gcc-unwrapped,
python,
fetchpatch,
}:

let
boringsslPatched = boringssl.overrideAttrs (oldAttrs: {
# boringssl source obtained from https://github.com/0x676e67/boring2/tree/1a0f1cd24e728aac100df68027c820f858199224/boring-sys/deps
src = fetchFromGitHub {
owner = "google";
repo = "boringssl";
rev = "44b3df6f03d85c901767250329c571db405122d5";
hash = "sha256-REELo7X9aFy2OHjubYLO1UQXLTgekD4QFd2vyFthIrg=";
};

patches = [
# A patch required to build boringssl compatible with `boring-sys2`.
# See https://github.com/0x676e67/boring2/blob/1a0f1cd24e728aac100df68027c820f858199224/boring-sys/build/main.rs#L486-L489
(fetchpatch {
name = "boringssl-44b3df6f03d85c901767250329c571db405122d5.patch";
url = "https://raw.githubusercontent.com/0x676e67/boring2/4edbff8cade24d5d83cc372c4502b59c5192b5a1/boring-sys/patches/boringssl-44b3df6f03d85c901767250329c571db405122d5.patch";
hash = "sha256-lM+2lLvfDHnxLl+OgZ6R8Y4Z6JfA9AiDqboT1mbxmao=";
})
];

# Remove bazel specific build file to make way for build directory
# This is a problem on Darwin because of case-insensitive filesystem
preBuild =
(lib.optionalString stdenv.isDarwin ''
rm BUILD
'')
+ oldAttrs.preBuild;

installPhase = ''
runHook preInstall
install -Dm 755 bssl "$bin/bin/bssl"
install -Dm 644 libssl.a "$out/lib/libssl.a"
install -Dm 644 libcrypto.a "$out/lib/libcrypto.a"
mkdir -p "$dev"
cp -r ../src/include "$dev/"
runHook postInstall
'';
});
# boring-sys expects the static libraries in build/ instead of lib/
boringssl-wrapper = runCommand "boringssl-wrapper" { } ''
mkdir $out
cd $out
ln -s ${boringssl.out}/lib build
ln -s ${boringssl.dev}/include include
mkdir -p $out
ln -s ${boringsslPatched.out}/lib $out/build
ln -s ${boringsslPatched.dev}/include $out/include
'';
in
buildPythonPackage rec {
pname = "primp";
version = "0.6.5";
version = "0.12.0";
pyproject = true;

src = fetchFromGitHub {
owner = "deedy5";
repo = "primp";
tag = "v${version}";
hash = "sha256-dexJdeNGpRsPLk8b/gNeQc1dsQLOiXNL5zgDEN9qHfQ=";
hash = "sha256-yzcrUER+NiDfSjJ3my45IS+2GmeusvJgyX5nFSaqFUk=";
};

cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
name = "${pname}-${version}";
hash = "sha256-s+LAuZmnmTDPIFDSi9AkyWposFFnboJCmog1kiEBnrw=";
hash = "sha256-gCNnP0B0D6AJ1L/E6sQKASx8BbSJU5jTNia+tL2USvU=";
};

nativeBuildInputs = [
Expand All @@ -58,6 +98,7 @@ buildPythonPackage rec {
];

env.BORING_BSSL_PATH = boringssl-wrapper;
env.BORING_BSSL_ASSUME_PATCHED = true;

optional-dependencies = {
dev = [ pytest ];
Expand Down

0 comments on commit dc7f6c2

Please sign in to comment.