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
8 src = fetchFromGitHub {
9 owner = "petertodd";
10 rev = "7a8a47ec6b722339de1d0a8144e55b400216f90f";
11 repo = "python-bitcoinlib";
12 sha256 = "1s1jm2nid7ab7yiwlp1n2v3was9i4q76xmm07wvzpd2zvn5zb91z";
13 };
14
15 postPatch = ''
16 substituteInPlace bitcoin/core/key.py --replace \
17 "ctypes.util.find_library('ssl') or 'libeay32'" \
18 "'${openssl.out}/lib/libssl.${ext}'"
19 '';
20
21 meta = {
22 homepage = src.meta.homepage;
23 description = "Easy interface to the Bitcoin data structures and protocol";
24 license = with lib.licenses; [ gpl3 ];
25 maintainers = with lib.maintainers; [ jb55 ];
26 };
27}