git.iko.soy/typeable/nixpkgs
on master help sign in
pythonPackages.blspy: init at 1.0.2
commitffdf830cdde81cde4b4c2b72bd344dc2e57a7680 authorLouis Bettens <louis@bettens.info> dateSun 9 May 2021, 16:30 (6 years ago) parentd4fdd9a
3 files changed+98
pkgs/development/python-modules/blspy/default.nix+58 pkgs/development/python-modules/blspy/dont_fetch_dependencies.patch+38 pkgs/top-level/python-packages.nix+2
pkgs/development/python-modules/blspy/default.nixnew file+58
@@ -0,0 +1,58 @@
1+{ lib
2+, buildPythonPackage
3+, fetchPypi
4+, fetchFromGitHub
5+, setuptools-scm
6+, substituteAll
7+, cmake
8+, boost
9+, gmp
10+, pybind11
11+, pythonOlder
12+}:
13+
14+buildPythonPackage rec {
15+ pname = "blspy";
16+ version = "1.0.2";
17+ disabled = pythonOlder "3.7";
18+
19+ src = fetchPypi {
20+ inherit pname version;
21+ hash = "sha256-N1mk83uZrzSty2DyXfKiVp85z/jmztiUSRXKfNBRJV4=";
22+ };
23+
24+ patches = [
25+ # prevent CMake from trying to get libraries on the Internet
26+ (substituteAll {
27+ src = ./dont_fetch_dependencies.patch;
28+ pybind11_src = pybind11.src;
29+ relic_src = fetchFromGitHub {
30+ owner = "relic-toolkit";
31+ repo = "relic";
32+ rev = "1885ae3b681c423c72b65ce1fe70910142cf941c"; # pinned by blspy
33+ hash = "sha256-tsSZTcssl8t7Nqdex4BesgQ+ACPgTdtHnJFvS9josN0=";
34+ };
35+ })
36+ ];
37+
38+ nativeBuildInputs = [ cmake setuptools-scm ];
39+
40+ buildInputs = [ boost gmp.static pybind11 ];
41+
42+ pythonImportsCheck = [
43+ "blspy"
44+ ];
45+
46+ # Note: upstream testsuite is just a single test.py script outside of any framework
47+ doCheck = false;
48+
49+ # CMake needs to be run by setuptools rather than by its hook
50+ dontConfigure = true;
51+
52+ meta = with lib; {
53+ description = "BLS signatures with aggregation";
54+ homepage = "https://github.com/Chia-Network/bls-signatures/";
55+ license = licenses.asl20;
56+ maintainers = teams.chia.members;
57+ };
58+}
pkgs/development/python-modules/blspy/dont_fetch_dependencies.patchnew file+38
@@ -0,0 +1,38 @@
1+diff --git a/python-bindings/CMakeLists.txt b/python-bindings/CMakeLists.txt
2+index 255e3bb..5f99c3a 100644
3+--- a/python-bindings/CMakeLists.txt
4++++ b/python-bindings/CMakeLists.txt
5+@@ -6,8 +6,7 @@ include(FetchContent)
6+
7+ FetchContent_Declare(
8+ pybind11
9+- GIT_REPOSITORY https://github.com/pybind/pybind11.git
10+- GIT_TAG v2.6.2
11++ SOURCE_DIR @pybind11_src@
12+ )
13+ FetchContent_MakeAvailable(pybind11 relic)
14+
15+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
16+index faecc61..3272116 100644
17+--- a/src/CMakeLists.txt
18++++ b/src/CMakeLists.txt
19+@@ -4,18 +4,9 @@ set (CMAKE_CXX_STANDARD 17)
20+ # CMake 3.14+
21+ include(FetchContent)
22+
23+-if (DEFINED ENV{RELIC_MAIN})
24+- set(RELIC_GIT_TAG "origin/main")
25+-else ()
26+- set(RELIC_GIT_TAG "1885ae3b681c423c72b65ce1fe70910142cf941c")
27+-endif ()
28+-
29+-message(STATUS "Relic will be built from: ${RELIC_GIT_TAG}")
30+-
31+ FetchContent_Declare(
32+ relic
33+- GIT_REPOSITORY https://github.com/relic-toolkit/relic.git
34+- GIT_TAG ${RELIC_GIT_TAG}
35++ SOURCE_DIR @relic_src@
36+ )
37+ FetchContent_MakeAvailable(relic)
38+
pkgs/top-level/python-packages.nix+2
@@ -1091,6 +1091,8 @@ in {
10911091
10921092 block-io = callPackage ../development/python-modules/block-io { };
10931093
1094+ blspy = callPackage ../development/python-modules/blspy { };
1095+
10941096 bluepy = callPackage ../development/python-modules/bluepy { };
10951097
10961098 bluepy-devices = callPackage ../development/python-modules/bluepy-devices { };