NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.29k stars 13.54k forks source link

python-trezor broken by non-propagated mnemonic dependency #30831

Closed clefru closed 6 years ago

clefru commented 6 years ago

Issue description

trezorctl can't find mnemonic package and fails to launch. pkgs/development/python-modules/trezor/default.nix has:

buildInputs = [ ecdsa mnemonic ];

but

grep "sys.argv[0] =" /nix/store/nq0la9k69xka1ybysc72i5iba01641s9-python2.7-trezor-0.7.16/bin/.trezorctl-wrapped  \
  | grep mnemonic \
  | wc
      0       0       0

shows that mnemonic isn't added to the sitepackages. Manually setting PYTHONPATH to include mnemonic and its pbkdf2 dep. fixes it:

$ export PYTHONPATH=/nix/store/qvvyr2g73x6qb2g8cmlzbagwdd60ggf4-python2.7-mnemonic-0.17/lib/python2.7/site-packages/mnemonic:/nix/store/hc2aff9p7bb501p5ffkpg0kswbwra9l7-python2.7-pbkdf2-1.3/lib/python2.7/site-packages 
$ trezorctl list
[...]
$ 

I don't know how to make the generator for ".trezorctl-wrapped" include additional packages.

Steps to reproduce

nix-env -iA nixos.python27Packages.trezor
trezorctl
Traceback (most recent call last):
  File "/nix/store/nq0la9k69xka1ybysc72i5iba01641s9-python2.7-trezor-0.7.16/bin/.trezorctl-wrapped", line 33, in <module>
    from trezorlib.client import TrezorClient, TrezorClientDebug, CallException
  File "/nix/store/nq0la9k69xka1ybysc72i5iba01641s9-python2.7-trezor-0.7.16/lib/python2.7/site-packages/trezorlib/client.py", line 31, in <module>
    from mnemonic import Mnemonic
ImportError: No module named mnemonic

Technical details

clefru commented 6 years ago

Btw, the non-propagation of mnemonic/pkbdf2 also breaks trezor support in Electrum. Given that I'll rename the issue that trezor lib is in general broken for all users.