1{ stdenv, lib, buildPythonPackage, fetchFromGitHub, openssl }:
2
3let ext = if stdenv.isDarwin then "dylib" else "so";
4in buildPythonPackage rec {
5 pname = "bitcoinlib";
6 version = "0.9.0";
7 name = "${pname}-${version}";
8
9 src = fetchFromGitHub {
10 owner = "petertodd";
11 rev = "7a8a47ec6b722339de1d0a8144e55b400216f90f";
12 repo = "python-bitcoinlib";
13 sha256 = "1s1jm2nid7ab7yiwlp1n2v3was9i4q76xmm07wvzpd2zvn5zb91z";
14 };
15
16 postPatch = ''
17 substituteInPlace bitcoin/core/key.py --replace \
18 "ctypes.util.find_library('ssl') or 'libeay32'" \
19 "'${openssl.out}/lib/libssl.${ext}'"
20 '';
21
22 meta = {
23 homepage = src.meta.homepage;
24 description = "Easy interface to the Bitcoin data structures and protocol";
25 license = with lib.licenses; [ gpl3 ];
26 maintainers = with lib.maintainers; [ jb55 ];
27 };
28}