1{ lib
2, buildPythonPackage
3, fetchPypi
4, isPy3k
5, installShellFiles
6, attrs
7, click
8, construct
9, ecdsa
10, hidapi
11, libusb1
12, mnemonic
13, pillow
14, protobuf
15, pyblake2
16, requests
17, rlp
18, shamir-mnemonic
19, typing-extensions
20, trezor-udev-rules
21, pytest
22}:
23
24buildPythonPackage rec {
25 pname = "trezor";
26 version = "0.12.2";
27
28 disabled = !isPy3k;
29
30 src = fetchPypi {
31 inherit pname version;
32 sha256 = "0r0j0y0ii62ppawc8qqjyaq0fkmmb0zk1xb3f9navxp556w2dljv";
33 };
34
35 nativeBuildInputs = [ installShellFiles ];
36
37 propagatedBuildInputs = [
38 attrs
39 click
40 construct
41 ecdsa
42 hidapi
43 libusb1
44 mnemonic
45 pillow
46 protobuf
47 pyblake2
48 requests
49 rlp
50 shamir-mnemonic
51 typing-extensions
52 trezor-udev-rules
53 ];
54
55 checkInputs = [
56 pytest
57 ];
58
59 # disable test_tx_api.py as it requires being online
60 checkPhase = ''
61 runHook preCheck
62 pytest --pyargs tests --ignore tests/test_tx_api.py
63 runHook postCheck
64 '';
65
66 postFixup = ''
67 mkdir completions
68 _TREZORCTL_COMPLETE=source_bash $out/bin/trezorctl > completions/trezorctl || true
69 _TREZORCTL_COMPLETE=source_zsh $out/bin/trezorctl > completions/_trezorctl || true
70 _TREZORCTL_COMPLETE=source_fish $out/bin/trezorctl > completions/trezorctl.fish || true
71 installShellCompletion --bash completions/trezorctl
72 installShellCompletion --zsh completions/_trezorctl
73 installShellCompletion --fish completions/trezorctl.fish
74 '';
75
76 meta = with lib; {
77 description = "Python library for communicating with Trezor Hardware Wallet";
78 homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
79 license = licenses.gpl3;
80 maintainers = with maintainers; [ np prusnak mmahut _1000101 ];
81 };
82}