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