1{
2 lib,
3 fetchFromGitHub,
4 bech32,
5 buildPythonPackage,
6 cryptography,
7 ed25519,
8 ecdsa,
9 gnupg,
10 semver,
11 mnemonic,
12 unidecode,
13 mock,
14 pytest,
15 backports-shutil-which,
16 configargparse,
17 python-daemon,
18 pymsgbox,
19 pynacl,
20}:
21
22# When changing this package, please test packages {keepkey,ledger,onlykey,trezor}-agent
23
24buildPythonPackage rec {
25 pname = "libagent";
26 version = "0.14.8";
27 format = "setuptools";
28
29 src = fetchFromGitHub {
30 owner = "romanz";
31 repo = "trezor-agent";
32 rev = "v${version}";
33 hash = "sha256-tcVott/GlHsICQf640Gm5jx89fZWsCdcYnBxi/Kh2oc=";
34 };
35
36 # hardcode the path to gpgconf in the libagent library
37 postPatch = ''
38 substituteInPlace libagent/gpg/keyring.py \
39 --replace "util.which('gpgconf')" "'${gnupg}/bin/gpgconf'" \
40 --replace "'gpg-connect-agent'" "'${gnupg}/bin/gpg-connect-agent'"
41 '';
42
43 propagatedBuildInputs = [
44 unidecode
45 backports-shutil-which
46 configargparse
47 python-daemon
48 pymsgbox
49 ecdsa
50 ed25519
51 mnemonic
52 semver
53 pynacl
54 bech32
55 cryptography
56 ];
57
58 nativeCheckInputs = [
59 mock
60 pytest
61 ];
62
63 checkPhase = ''
64 py.test libagent/tests
65 '';
66
67 meta = with lib; {
68 description = "Using hardware wallets as SSH/GPG agent";
69 homepage = "https://github.com/romanz/trezor-agent";
70 license = licenses.lgpl3Only;
71 maintainers = with maintainers; [ np ];
72 };
73}