From 681268d2e0fada6f8b82e04c4ffcea52f92c7893 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Fri, 24 Jul 2020 14:48:32 +0200 Subject: [PATCH] pythonPackages.trezor: enable shell completion --- pkgs/development/python-modules/trezor/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/development/python-modules/trezor/default.nix b/pkgs/development/python-modules/trezor/default.nix index e7bec00863ae..e16f4027ce54 100644 --- a/pkgs/development/python-modules/trezor/default.nix +++ b/pkgs/development/python-modules/trezor/default.nix @@ -12,6 +12,7 @@ , rlp , shamir-mnemonic , trezor-udev-rules +, installShellFiles }: buildPythonPackage rec { @@ -25,6 +26,8 @@ buildPythonPackage rec { sha256 = "0ycmpwjv5xp25993divjhaq5j766zgcy22xx39xfc1pcvldq5g7n"; }; + nativeBuildInputs = [ installShellFiles ]; + propagatedBuildInputs = [ typing-extensions protobuf hidapi ecdsa mnemonic requests pyblake2 click construct libusb1 rlp shamir-mnemonic trezor-udev-rules ]; checkInputs = [ @@ -38,6 +41,16 @@ buildPythonPackage rec { 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";