1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchFromGitHub
5, fetchpatch
6, setuptools-scm
7, substituteAll
8, cmake
9, boost
10, gmp
11, pybind11
12, pythonOlder
13}:
14
15buildPythonPackage rec {
16 pname = "blspy";
17 version = "1.0.6";
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-sULXnecEs8VI687pR9EK9jjYWlrB4tV4dt7Kzekaxb4=";
23 };
24
25 patches = [
26 # prevent CMake from trying to get libraries on the Internet
27 (substituteAll {
28 src = ./dont_fetch_dependencies.patch;
29 pybind11_src = pybind11.src;
30 relic_src = fetchFromGitHub {
31 owner = "relic-toolkit";
32 repo = "relic";
33 rev = "1885ae3b681c423c72b65ce1fe70910142cf941c"; # pinned by blspy
34 hash = "sha256-tsSZTcssl8t7Nqdex4BesgQ+ACPgTdtHnJFvS9josN0=";
35 };
36 sodium_src = fetchFromGitHub {
37 owner = "AmineKhaldi";
38 repo = "libsodium-cmake";
39 rev = "f73a3fe1afdc4e37ac5fe0ddd401bf521f6bba65"; # pinned by blspy
40 sha256 = "sha256-lGz7o6DQVAuEc7yTp8bYS2kwjzHwGaNjugDi1ruRJOA=";
41 fetchSubmodules = true;
42 };
43 })
44
45 # avoid dynamic linking error at import time
46 (fetchpatch {
47 url = "https://github.com/Chia-Network/bls-signatures/pull/287/commits/797241e9dae1c164c862cbdb38c865d4b124a601.patch";
48 sha256 = "sha256-tlc4aA75gUxt5OaSNZqIlO//PXjmddVgVLYuVEFNmkE=";
49 })
50 ];
51
52 nativeBuildInputs = [ cmake setuptools-scm ];
53
54 buildInputs = [ boost gmp.static pybind11 ];
55
56 pythonImportsCheck = [
57 "blspy"
58 ];
59
60 # Note: upstream testsuite is just a single test.py script outside of any framework
61 doCheck = false;
62
63 # CMake needs to be run by setuptools rather than by its hook
64 dontConfigure = true;
65
66 meta = with lib; {
67 description = "BLS signatures with aggregation";
68 homepage = "https://github.com/Chia-Network/bls-signatures/";
69 license = licenses.asl20;
70 maintainers = teams.chia.members;
71 };
72}