summary refs log tree commit diff
path: root/pkgs/development/python-modules/hwi/default.nix
blob: fabe8c3f95dfe0e4da86f1f768a89b89c5184f20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ lib
, buildPythonPackage
, fetchFromGitHub
, bitbox02
, cbor
, ecdsa
, hidapi
, libusb1
, mnemonic
, pyaes
, pyserial
, typing-extensions
, pythonOlder
}:

buildPythonPackage rec {
  pname = "hwi";
  version = "2.1.1";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "bitcoin-core";
    repo = "HWI";
    rev = version;
    sha256 = "sha256-jsJjGezf2JrPYr3YNZGx23Jo14DbmM1S6bu7+xgZh58=";
  };

  propagatedBuildInputs = [
    bitbox02
    cbor
    ecdsa
    hidapi
    libusb1
    mnemonic
    pyaes
    pyserial
    typing-extensions
  ];

  # relax required dependencies:
  # libusb1           - https://github.com/bitcoin-core/HWI/issues/579
  # typing-extensions - https://github.com/bitcoin-core/HWI/issues/572
  postPatch = ''
    substituteInPlace setup.py \
      --replace 'libusb1>=1.7,<3' 'libusb1>=1.7,<4' \
      --replace 'typing-extensions>=3.7,<4.0' 'typing-extensions>=3.7,<5.0'
  '';

  # tests require to clone quite a few firmwares
  doCheck = false;

  pythonImportsCheck = [
    "hwilib"
  ];

  meta = with lib; {
    description = "Bitcoin Hardware Wallet Interface";
    homepage = "https://github.com/bitcoin-core/hwi";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ prusnak ];
  };
}