1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 click,
7 construct,
8 construct-classes,
9 ecdsa,
10 libusb1,
11 mnemonic,
12 requests,
13 setuptools,
14 typing-extensions,
15 trezor-udev-rules,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "trezor";
21 version = "0.13.9";
22 pyproject = true;
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-lFC9e7nSPl4zo8nljhjwWLRMnZw0ymZLSYGnlaqfse8=";
27 };
28
29 build-system = [ setuptools ];
30
31 dependencies = [
32 click
33 construct
34 construct-classes
35 ecdsa
36 libusb1
37 mnemonic
38 requests
39 typing-extensions
40 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ trezor-udev-rules ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 disabledTestPaths = [
45 "tests/test_stellar.py" # requires stellar-sdk
46 "tests/test_firmware.py" # requires network downloads
47 ];
48
49 pythonImportsCheck = [ "trezorlib" ];
50
51 postCheck = ''
52 $out/bin/trezorctl --version
53 '';
54
55 meta = with lib; {
56 description = "Python library for communicating with Trezor Hardware Wallet";
57 mainProgram = "trezorctl";
58 homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
59 changelog = "https://github.com/trezor/trezor-firmware/blob/python/v${version}/python/CHANGELOG.md";
60 license = licenses.lgpl3Only;
61 maintainers = with maintainers; [
62 np
63 prusnak
64 mmahut
65 ];
66 };
67}