nixpkgs/pkgs/development/python-modules/trezor/default.nix
2020-08-18 07:59:48 +10:00

61 lines
1.6 KiB
Nix

{ lib, fetchPypi, buildPythonPackage, isPy3k, python, pytest
, typing-extensions
, protobuf
, hidapi
, ecdsa
, mnemonic
, requests
, pyblake2
, click
, construct
, libusb1
, rlp
, shamir-mnemonic
, trezor-udev-rules
, installShellFiles
}:
buildPythonPackage rec {
pname = "trezor";
version = "0.12.1";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "1w19m9lws55k9sjhras47hpfpqwq1jm5vy135nj65yhkblygqg19";
};
nativeBuildInputs = [ installShellFiles ];
propagatedBuildInputs = [ typing-extensions protobuf hidapi ecdsa mnemonic requests pyblake2 click construct libusb1 rlp shamir-mnemonic trezor-udev-rules ];
checkInputs = [
pytest
];
# disable test_tx_api.py as it requires being online
checkPhase = ''
runHook preCheck
pytest --pyargs tests --ignore tests/test_tx_api.py
runHook postCheck
'';
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
'';
meta = with lib; {
description = "Python library for communicating with TREZOR Bitcoin Hardware Wallet";
homepage = "https://github.com/trezor/trezor-firmware/tree/master/python";
license = licenses.gpl3;
maintainers = with maintainers; [ np prusnak mmahut _1000101 ];
};
}