lol
1{ stdenv, fetchurl, python3, python3Packages, zbar }:
2
3python3Packages.buildPythonApplication rec {
4 name = "electrum-${version}";
5 version = "3.1.3";
6
7 src = fetchurl {
8 url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
9 sha256 = "05m28yd3zr9awjhaqikf4rg08j5i4ygm750ip1z27wl446sysniy";
10 };
11
12 propagatedBuildInputs = with python3Packages; [
13 dnspython
14 ecdsa
15 jsonrpclib-pelix
16 matplotlib
17 pbkdf2
18 protobuf
19 pyaes
20 pycrypto
21 pyqt5
22 pysocks
23 qrcode
24 requests
25 tlslite
26
27 # plugins
28 keepkey
29 trezor
30
31 # TODO plugins
32 # amodem
33 # btchip
34 ];
35
36 preBuild = ''
37 sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
38 pyrcc5 icons.qrc -o gui/qt/icons_rc.py
39 # Recording the creation timestamps introduces indeterminism to the build
40 sed -i '/Created: .*/d' gui/qt/icons_rc.py
41 sed -i "s|name = 'libzbar.*'|name='${zbar}/lib/libzbar.so'|" lib/qrscanner.py
42 '';
43
44 postInstall = ''
45 # Despite setting usr_share above, these files are installed under
46 # $out/nix ...
47 mv $out/${python3.sitePackages}/nix/store"/"*/share $out
48 rm -rf $out/${python3.sitePackages}/nix
49
50 substituteInPlace $out/share/applications/electrum.desktop \
51 --replace "Exec=electrum %u" "Exec=$out/bin/electrum %u"
52 '';
53
54 doCheck = false;
55
56 doInstallCheck = true;
57 installCheckPhase = ''
58 $out/bin/electrum help >/dev/null
59 '';
60
61 meta = with stdenv.lib; {
62 description = "A lightweight Bitcoin wallet";
63 longDescription = ''
64 An easy-to-use Bitcoin client featuring wallets generated from
65 mnemonic seeds (in addition to other, more advanced, wallet options)
66 and the ability to perform transactions without downloading a copy
67 of the blockchain.
68 '';
69 homepage = https://electrum.org/;
70 license = licenses.mit;
71 maintainers = with maintainers; [ ehmry joachifm np ];
72 };
73}