Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / electrum / grs.nix
bloba0c9e49fb60ebe981567e15a3c63be44c37a085d
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , wrapQtAppsHook
5 , python3
6 , zbar
7 , secp256k1
8 , enableQt ? true
9 }:
11 let
12   version = "4.4.4";
14   libsecp256k1_name =
15     if stdenv.isLinux then "libsecp256k1.so.{v}"
16     else if stdenv.isDarwin then "libsecp256k1.{v}.dylib"
17     else "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
19   libzbar_name =
20     if stdenv.isLinux then "libzbar.so.0"
21     else if stdenv.isDarwin then "libzbar.0.dylib"
22     else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
26 python3.pkgs.buildPythonApplication {
27   pname = "electrum-grs";
28   inherit version;
30   src = fetchFromGitHub {
31     owner = "Groestlcoin";
32     repo = "electrum-grs";
33     rev = "refs/tags/v${version}";
34     sha256 = "0fl01qdvb1z6l6kwipj1lj0qmjk3mzw25wv7yh5j1hh1f5lng0s8";
35   };
37   nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
39   propagatedBuildInputs = with python3.pkgs; [
40     aiohttp
41     aiohttp-socks
42     aiorpcx
43     attrs
44     bitstring
45     cryptography
46     dnspython
47     groestlcoin_hash
48     jsonrpclib-pelix
49     matplotlib
50     pbkdf2
51     protobuf
52     pysocks
53     qrcode
54     requests
55     tlslite-ng
56     # plugins
57     btchip-python
58     ledger-bitcoin
59     ckcc-protocol
60     keepkey
61     trezor
62   ] ++ lib.optionals enableQt [
63     pyqt5
64     qdarkstyle
65   ];
67   postPatch = ''
68     # make compatible with protobuf4 by easing dependencies ...
69     substituteInPlace ./contrib/requirements/requirements.txt \
70       --replace "protobuf>=3.20,<4" "protobuf>=3.20"
71     # ... and regenerating the paymentrequest_pb2.py file
72     protoc --python_out=. electrum_grs/paymentrequest.proto
74     substituteInPlace ./electrum_grs/ecc_fast.py \
75       --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
76   '' + (if enableQt then ''
77     substituteInPlace ./electrum_grs/qrscanner.py \
78       --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
79   '' else ''
80     sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
81   '');
83   postInstall = lib.optionalString stdenv.isLinux ''
84     substituteInPlace $out/share/applications/electrum-grs.desktop \
85       --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-grs %u"' \
86                 "Exec=$out/bin/electrum-grs %u" \
87       --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-grs --testnet %u"' \
88                 "Exec=$out/bin/electrum-grs --testnet %u"
89   '';
91   postFixup = lib.optionalString enableQt ''
92     wrapQtApp $out/bin/electrum-grs
93   '';
95   # the tests are currently broken
96   doCheck = false;
98   postCheck = ''
99     $out/bin/electrum-grs help >/dev/null
100   '';
102   meta = with lib; {
103     description = "Lightweight Groestlcoin wallet";
104     longDescription = ''
105       An easy-to-use Groestlcoin client featuring wallets generated from
106       mnemonic seeds (in addition to other, more advanced, wallet options)
107       and the ability to perform transactions without downloading a copy
108       of the blockchain.
109     '';
110     homepage = "https://groestlcoin.org/";
111     downloadPage = "https://github.com/Groestlcoin/electrum-grs/releases/tag/v{version}";
112     license = licenses.mit;
113     platforms = platforms.all;
114     maintainers = with maintainers; [ gruve-p ];
115   };