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