Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / electron-cash / default.nix
blob16eb89cb5a845c9fb51592667a5c7c5d241a2fb6
1 { lib, stdenv, fetchFromGitHub, python3Packages, wrapQtAppsHook
2 , secp256k1 }:
4 python3Packages.buildPythonApplication rec {
5   pname = "electron-cash";
6   version = "4.2.10";
8   src = fetchFromGitHub {
9     owner = "Electron-Cash";
10     repo = "Electron-Cash";
11     rev = "refs/tags/${version}";
12     sha256 = "sha256-m13wJlNBG3BxOdKUyd3qmIhFBM7263FzMKr5lfD1tys=";
13   };
15   propagatedBuildInputs = with python3Packages; [
16     # requirements
17     pyaes
18     ecdsa
19     requests
20     qrcode
21     protobuf
22     jsonrpclib-pelix
23     pysocks
24     qdarkstyle
25     python-dateutil
26     stem
27     certifi
28     pathvalidate
29     dnspython
31     # requirements-binaries
32     pyqt5
33     psutil
34     pycryptodomex
35     cryptography
37     # requirements-hw
38     cython
39     trezor
40     keepkey
41     btchip-python
42     hidapi
43     pyopenssl
44     pyscard
45     pysatochip
46   ];
48   nativeBuildInputs = [ wrapQtAppsHook ];
50   postPatch = ''
51     substituteInPlace contrib/requirements/requirements.txt \
52       --replace "qdarkstyle==2.6.8" "qdarkstyle<3"
54     substituteInPlace setup.py \
55       --replace "(share_dir" "(\"share\""
56   '';
58   nativeCheckInputs = with python3Packages; [ pytest ];
60   checkPhase = ''
61     unset HOME
62     pytest electroncash/tests
63   '';
65   postInstall = lib.optionalString stdenv.isLinux ''
66     substituteInPlace $out/share/applications/electron-cash.desktop \
67       --replace "Exec=electron-cash" "Exec=$out/bin/electron-cash"
68   '';
70   # If secp256k1 wasn't added to the library path, the following warning is given:
71   #
72   #   Electron Cash was unable to find the secp256k1 library on this system.
73   #   Elliptic curve cryptography operations will be performed in slow
74   #   Python-only mode.
75   preFixup = ''
76     makeWrapperArgs+=("''${qtWrapperArgs[@]}")
77     makeWrapperArgs+=(
78       "--prefix" "LD_LIBRARY_PATH" ":" "${secp256k1}/lib"
79     )
80   '';
82   doInstallCheck = true;
83   installCheckPhase = ''
84     $out/bin/electron-cash help >/dev/null
85   '';
87   meta = with lib; {
88     description = "A Bitcoin Cash SPV Wallet";
89     longDescription = ''
90       An easy-to-use Bitcoin Cash client featuring wallets generated from
91       mnemonic seeds (in addition to other, more advanced, wallet options)
92       and the ability to perform transactions without downloading a copy
93       of the blockchain.
94     '';
95     homepage = "https://www.electroncash.org/";
96     platforms = platforms.unix;
97     maintainers = with maintainers; [ lassulus nyanloutre oxalica ];
98     license = licenses.mit;
99   };