Files
Wroclaw 69fd82a719 python3Packages.libagent: hardcode pinentry path
gpgconf --list-components reports pinentry inside the gnupg store
path, but we ship pinentry as a separate package. Patch
get_pinentry_binary() to use pinentry-curses directly.
2026-05-29 23:58:58 +02:00

90 lines
1.9 KiB
Nix

{
lib,
fetchFromGitHub,
backports-shutil-which,
bech32,
buildPythonPackage,
setuptools,
cryptography,
docutils,
ecdsa,
gnupg,
pinentry-curses,
semver,
mnemonic,
unidecode,
mock,
pytestCheckHook,
configargparse,
python-daemon,
pymsgbox,
pynacl,
nix-update-script,
}:
# When changing this package, please test packages {onlykey,trezor}-agent
buildPythonPackage (finalAttrs: {
pname = "libagent";
version = "0.16.1";
pyproject = true;
src = fetchFromGitHub {
owner = "romanz";
repo = "trezor-agent";
tag = "libagent/${finalAttrs.version}";
hash = "sha256-JFHBE2o5VSJaz5yeCiXmBchm4/1gA+dZ/PRt3+WENdA=";
};
# hardcode the path to gpgconf and pinentry in the libagent library
postPatch = ''
substituteInPlace libagent/gpg/keyring.py \
--replace "util.which('gpgconf')" "'${gnupg}/bin/gpgconf'" \
--replace "'gpg-connect-agent'" "'${gnupg}/bin/gpg-connect-agent'" \
--replace "get_gnupg_components(sp=sp)['pinentry']" "'${(lib.getExe pinentry-curses)}'"
'';
build-system = [ setuptools ];
# https://github.com/romanz/trezor-agent/pull/481
pythonRemoveDeps = [ "backports.shutil-which" ];
dependencies = [
backports-shutil-which
unidecode
configargparse
python-daemon
pymsgbox
ecdsa
docutils
mnemonic
semver
pynacl
bech32
cryptography
];
pythonImportsCheck = [ "libagent" ];
nativeCheckInputs = [
mock
pytestCheckHook
];
disabledTests = [
# test fails in sandbox
"test_get_agent_sock_path"
];
passthru.updateScript = nix-update-script {
extraArgs = [ "--version-regex=libagent/(.*)" ];
};
meta = {
description = "Using hardware wallets as SSH/GPG agent";
homepage = "https://github.com/romanz/trezor-agent";
license = lib.licenses.lgpl3Only;
maintainers = with lib.maintainers; [ np ];
};
})