1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 # build-system
8 cmake,
9 hatchling,
10 ninja,
11 pkg-config,
12 setuptools,
13 scikit-build-core,
14
15 # dependencies
16 asn1crypto,
17 cffi,
18 secp256k1,
19
20 # checks
21 pytestCheckHook,
22}:
23
24buildPythonPackage rec {
25 pname = "coincurve";
26 version = "21.0.0";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "ofek";
31 repo = "coincurve";
32 tag = "v${version}";
33 hash = "sha256-+8/CsV2BTKZ5O2LIh5/kOKMfFrkt2Jsjuj37oiOgO6Y=";
34 };
35
36 patches = [
37 # Build requires cffi LICENSE files
38 (fetchpatch {
39 url = "https://github.com/ofek/coincurve/commit/19597b0869803acfc669d916e43c669e9ffcced7.patch";
40 hash = "sha256-BkUxXjcwk3btcvSVaVZqVTJ+8E8CYtT5cTXLx9lxJ/g=";
41 })
42 ];
43
44 build-system = [
45 hatchling
46 cffi
47 cmake
48 ninja
49 pkg-config
50 setuptools
51 scikit-build-core
52 ];
53
54 dontUseCmakeConfigure = true;
55
56 env.COINCURVE_IGNORE_SYSTEM_LIB = "OFF";
57
58 buildInputs = [ secp256k1 ];
59
60 dependencies = [
61 asn1crypto
62 cffi
63 ];
64
65 nativeCheckInputs = [ pytestCheckHook ];
66
67 pythonImportsCheck = [ "coincurve" ];
68
69 meta = {
70 description = "Cross-platform bindings for libsecp256k1";
71 homepage = "https://github.com/ofek/coincurve";
72 license = with lib.licenses; [
73 asl20
74 mit
75 ];
76 maintainers = with lib.maintainers; [ ryand56 ];
77 };
78}