1{ lib
2, buildPythonPackage
3, fetchPypi
4, pkg-config
5, pytestCheckHook
6, cffi
7, secp256k1
8}:
9
10buildPythonPackage rec {
11 pname = "secp256k1";
12 version = "0.14.0";
13
14 src = fetchPypi {
15 inherit pname version;
16 sha256 = "82c06712d69ef945220c8b53c1a0d424c2ff6a1f64aee609030df79ad8383397";
17 };
18
19 postPatch = ''
20 # don't do hacky tarball download + setuptools check
21 sed -i '38,54d' setup.py
22 substituteInPlace setup.py --replace ", 'pytest-runner==2.6.2'" ""
23 '';
24
25 nativeBuildInputs = [ pkg-config ];
26
27 propagatedBuildInputs = [ cffi secp256k1 ];
28
29 nativeCheckInputs = [ pytestCheckHook ];
30
31 # Tests are not included in archive
32 doCheck = false;
33
34 preConfigure = ''
35 cp -r ${secp256k1.src} libsecp256k1
36 export INCLUDE_DIR=${secp256k1}/include
37 export LIB_DIR=${secp256k1}/lib
38 '';
39
40 meta = {
41 homepage = "https://github.com/ludbb/secp256k1-py";
42 description = "Python FFI bindings for secp256k1";
43 license = with lib.licenses; [ mit ];
44 maintainers = with lib.maintainers; [ ];
45 };
46}