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