1{ lib
2, python3Packages
3, onlykey-cli
4}:
5
6let
7 # onlykey requires a patched version of libagent
8 lib-agent = with python3Packages; libagent.overridePythonAttrs (oa: rec{
9 version = "1.0.2";
10 src = fetchPypi {
11 inherit version;
12 pname = "lib-agent";
13 sha256 = "sha256-NAimivO3m4UUPM4JgLWGq2FbXOaXdQEL/DqZAcy+kEw=";
14 };
15 propagatedBuildInputs = oa.propagatedBuildInputs or [ ] ++ [
16 pynacl
17 docutils
18 pycryptodome
19 wheel
20 ];
21
22 # turn off testing because I can't get it to work
23 doCheck = false;
24 pythonImportsCheck = [ "libagent" ];
25
26 meta = oa.meta // {
27 description = "Using OnlyKey as hardware SSH and GPG agent";
28 homepage = "https://github.com/trustcrypto/onlykey-agent/tree/ledger";
29 maintainers = with maintainers; [ kalbasit ];
30 };
31 });
32in
33python3Packages.buildPythonApplication rec {
34 pname = "onlykey-agent";
35 version = "1.1.11";
36
37 src = python3Packages.fetchPypi {
38 inherit pname version;
39 sha256 = "sha256-YH/cqQOVy5s6dTp2JwxM3s4xRTXgwhOr00whtHAwZZI=";
40 };
41
42 propagatedBuildInputs = with python3Packages; [ lib-agent onlykey-cli ];
43
44 # move the python library into the sitePackages.
45 postInstall = ''
46 mkdir $out/${python3Packages.python.sitePackages}/onlykey_agent
47 mv $out/bin/onlykey_agent.py $out/${python3Packages.python.sitePackages}/onlykey_agent/__init__.py
48 chmod a-x $out/${python3Packages.python.sitePackages}/onlykey_agent/__init__.py
49 '';
50
51 # no tests
52 doCheck = false;
53 pythonImportsCheck = [ "onlykey_agent" ];
54
55 meta = with lib; {
56 description = " The OnlyKey agent is essentially middleware that lets you use OnlyKey as a hardware SSH/GPG device.";
57 homepage = "https://github.com/trustcrypto/onlykey-agent";
58 license = licenses.lgpl3Only;
59 maintainers = with maintainers; [ kalbasit ];
60 };
61}