1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 cryptography,
6 click,
7 construct,
8 ecdsa,
9 hidapi,
10 intelhex,
11 pillow,
12 protobuf,
13 requests,
14 setuptools,
15 setuptools-scm,
16 tabulate,
17 toml,
18}:
19
20buildPythonPackage rec {
21 pname = "ledgerwallet";
22 version = "0.5.3";
23 format = "pyproject";
24
25 src = fetchFromGitHub {
26 owner = "LedgerHQ";
27 repo = "ledgerctl";
28 rev = "v${version}";
29 hash = "sha256-roDfj+igDBS+sTJL4hwYNg5vZzaq+F8QvDA9NucnrMA=";
30 };
31
32 buildInputs = [
33 setuptools
34 setuptools-scm
35 ];
36 propagatedBuildInputs = [
37 cryptography
38 click
39 construct
40 ecdsa
41 hidapi
42 intelhex
43 pillow
44 protobuf
45 requests
46 tabulate
47 toml
48 ];
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace-fail '"protobuf >=3.20,<4"' '"protobuf >=3.20"'
53 '';
54
55 # Regenerate protobuf bindings to lift the version upper-bound and enable
56 # compatibility the current default protobuf library.
57 preBuild = ''
58 protoc --python_out=. --pyi_out=. ledgerwallet/proto/*.proto
59 '';
60
61 pythonImportsCheck = [ "ledgerwallet" ];
62
63 meta = with lib; {
64 homepage = "https://github.com/LedgerHQ/ledgerctl";
65 description = "Library to control Ledger devices";
66 mainProgram = "ledgerctl";
67 license = licenses.mit;
68 maintainers = with maintainers; [
69 erdnaxe
70 ];
71 };
72}