2020-10-27 12:51:04 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-08-25 10:29:22 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, isPy3k
|
|
|
|
, installShellFiles
|
|
|
|
, attrs
|
2018-12-23 21:50:58 +00:00
|
|
|
, click
|
|
|
|
, construct
|
2020-08-25 10:29:22 +01:00
|
|
|
, ecdsa
|
|
|
|
, hidapi
|
2018-12-23 21:50:58 +00:00
|
|
|
, libusb1
|
2020-08-25 10:29:22 +01:00
|
|
|
, mnemonic
|
|
|
|
, pillow
|
|
|
|
, protobuf
|
|
|
|
, pyblake2
|
|
|
|
, requests
|
2018-12-23 21:50:58 +00:00
|
|
|
, rlp
|
2019-07-31 18:52:54 +01:00
|
|
|
, shamir-mnemonic
|
2020-08-25 10:29:22 +01:00
|
|
|
, typing-extensions
|
2019-10-27 13:17:02 +00:00
|
|
|
, trezor-udev-rules
|
2020-08-25 10:29:22 +01:00
|
|
|
, pytest
|
2017-06-22 13:27:11 +01:00
|
|
|
}:
|
2017-03-11 12:49:23 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "trezor";
|
2020-08-25 10:29:22 +01:00
|
|
|
version = "0.12.2";
|
2017-03-11 12:49:23 +00:00
|
|
|
|
2018-07-17 22:15:57 +01:00
|
|
|
disabled = !isPy3k;
|
|
|
|
|
2017-05-31 21:40:14 +01:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-08-25 10:29:22 +01:00
|
|
|
sha256 = "0r0j0y0ii62ppawc8qqjyaq0fkmmb0zk1xb3f9navxp556w2dljv";
|
2017-03-11 12:49:23 +00:00
|
|
|
};
|
|
|
|
|
2020-07-24 13:48:32 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2020-08-25 10:29:22 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
|
|
|
click
|
|
|
|
construct
|
|
|
|
ecdsa
|
|
|
|
hidapi
|
|
|
|
libusb1
|
|
|
|
mnemonic
|
|
|
|
pillow
|
|
|
|
protobuf
|
|
|
|
pyblake2
|
|
|
|
requests
|
|
|
|
rlp
|
|
|
|
shamir-mnemonic
|
|
|
|
typing-extensions
|
2020-10-27 12:51:04 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-08-25 10:29:22 +01:00
|
|
|
trezor-udev-rules
|
|
|
|
];
|
2017-03-11 12:49:23 +00:00
|
|
|
|
2018-12-23 21:50:58 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytest
|
|
|
|
];
|
|
|
|
|
|
|
|
# disable test_tx_api.py as it requires being online
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2019-09-26 16:48:42 +01:00
|
|
|
pytest --pyargs tests --ignore tests/test_tx_api.py
|
2018-12-23 21:50:58 +00:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
2017-03-11 12:49:23 +00:00
|
|
|
|
2020-07-24 13:48:32 +01:00
|
|
|
postFixup = ''
|
|
|
|
mkdir completions
|
|
|
|
_TREZORCTL_COMPLETE=source_bash $out/bin/trezorctl > completions/trezorctl || true
|
|
|
|
_TREZORCTL_COMPLETE=source_zsh $out/bin/trezorctl > completions/_trezorctl || true
|
|
|
|
_TREZORCTL_COMPLETE=source_fish $out/bin/trezorctl > completions/trezorctl.fish || true
|
|
|
|
installShellCompletion --bash completions/trezorctl
|
|
|
|
installShellCompletion --zsh completions/_trezorctl
|
|
|
|
installShellCompletion --fish completions/trezorctl.fish
|
|
|
|
'';
|
|
|
|
|
2019-08-18 20:16:19 +01:00
|
|
|
meta = with lib; {
|
2020-08-25 10:29:22 +01:00
|
|
|
description = "Python library for communicating with Trezor Hardware Wallet";
|
2019-07-31 18:52:54 +01:00
|
|
|
homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
|
2019-08-18 20:16:19 +01:00
|
|
|
license = licenses.gpl3;
|
2020-07-29 11:57:20 +01:00
|
|
|
maintainers = with maintainers; [ np prusnak mmahut _1000101 ];
|
2017-03-11 12:49:23 +00:00
|
|
|
};
|
|
|
|
}
|