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