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