nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 hatchling,
7 pytestCheckHook,
8 pytest-random-order,
9 # dependencies
10 click,
11 construct,
12 construct-classes,
13 cryptography,
14 keyring,
15 libusb1,
16 mnemonic,
17 noiseprotocol,
18 platformdirs,
19 requests,
20 shamir-mnemonic,
21 slip10,
22 typing-extensions,
23 # optional-dependencies
24 bleak,
25 pillow,
26 hidapi,
27 web3,
28 pyqt5,
29}:
30
31buildPythonPackage rec {
32 pname = "trezor";
33 version = "0.20.0";
34 pyproject = true;
35
36 src = fetchPypi {
37 inherit pname version;
38 hash = "sha256-TAmOIDFbJxZnOr3vQCgi5xiRAVmMfAPyN0ndIBDuJQQ=";
39 };
40
41 build-system = [ hatchling ];
42
43 dependencies = [
44 click
45 construct
46 construct-classes
47 cryptography
48 keyring
49 libusb1
50 mnemonic
51 noiseprotocol
52 platformdirs
53 requests
54 shamir-mnemonic
55 slip10
56 typing-extensions
57 ];
58
59 optional-dependencies = {
60 ble = [ bleak ];
61 extra = [ pillow ];
62 hidapi = [ hidapi ];
63 ethereum = [ web3 ];
64 qt-widgets = [ pyqt5 ];
65 # stellar = [ stellar-sdk ]; # missing in nixpkgs
66 full = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "full" ]));
67 };
68
69 nativeCheckInputs = [
70 pytestCheckHook
71 pytest-random-order
72 ];
73
74 disabledTestPaths = [
75 "tests/test_stellar.py" # requires stellar-sdk
76 "tests/test_firmware.py" # requires network downloads
77 ];
78
79 pythonImportsCheck = [ "trezorlib" ];
80
81 postCheck = ''
82 $out/bin/trezorctl --version
83 '';
84
85 meta = {
86 description = "Python library for communicating with Trezor Hardware Wallet";
87 mainProgram = "trezorctl";
88 homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
89 changelog = "https://github.com/trezor/trezor-firmware/blob/python/v${version}/python/CHANGELOG.md";
90 license = lib.licenses.lgpl3Only;
91 maintainers = with lib.maintainers; [
92 np
93 prusnak
94 mmahut
95 ];
96 };
97}