nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 137 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 protobuf, 6 wrapQtAppsHook, 7 python3, 8 zbar, 9 enableQt ? true, 10 callPackage, 11 qtwayland, 12}: 13 14let 15 libzbar_name = 16 if stdenv.hostPlatform.isLinux then 17 "libzbar.so.0" 18 else if stdenv.hostPlatform.isDarwin then 19 "libzbar.0.dylib" 20 else 21 "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}"; 22in 23python3.pkgs.buildPythonApplication rec { 24 pname = "electrum"; 25 version = "4.6.0"; 26 format = "setuptools"; 27 28 src = fetchurl { 29 url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz"; 30 hash = "sha256-aQqZXyfqFgc1j2r836eaaayOmSzDijHlYXmF+OBw418="; 31 }; 32 33 build-system = [ protobuf ] ++ lib.optionals enableQt [ wrapQtAppsHook ]; 34 buildInputs = lib.optional (stdenv.hostPlatform.isLinux && enableQt) qtwayland; 35 36 dependencies = 37 with python3.pkgs; 38 [ 39 aiohttp 40 aiohttp-socks 41 aiorpcx 42 attrs 43 bitstring 44 cryptography 45 dnspython 46 jsonrpclib-pelix 47 matplotlib 48 pbkdf2 49 protobuf 50 pysocks 51 qrcode 52 requests 53 certifi 54 jsonpatch 55 electrum-aionostr 56 electrum-ecc 57 # plugins 58 ledger-bitcoin 59 ckcc-protocol 60 keepkey 61 trezor 62 bitbox02 63 cbor2 64 pyserial 65 ] 66 ++ lib.optionals enableQt [ 67 pyqt6 68 qdarkstyle 69 ]; 70 71 checkInputs = 72 with python3.pkgs; 73 lib.optionals enableQt [ 74 pyqt6 75 ]; 76 77 postPatch = 78 if enableQt then 79 '' 80 substituteInPlace ./electrum/qrscanner.py \ 81 --replace-fail ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary} 82 '' 83 else 84 '' 85 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt 86 ''; 87 88 postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' 89 substituteInPlace $out/share/applications/electrum.desktop \ 90 --replace-fail "Exec=electrum %u" "Exec=$out/bin/electrum %u" \ 91 --replace-fail "Exec=electrum --testnet %u" "Exec=$out/bin/electrum --testnet %u" 92 ''; 93 94 postFixup = lib.optionalString enableQt '' 95 wrapQtApp $out/bin/electrum 96 ''; 97 98 nativeCheckInputs = with python3.pkgs; [ 99 pytestCheckHook 100 pyaes 101 pycryptodomex 102 ]; 103 104 enabledTestPaths = [ "tests" ]; 105 106 # avoid homeless-shelter error in tests 107 preCheck = '' 108 export HOME="$(mktemp -d)" 109 ''; 110 111 postCheck = '' 112 $out/bin/electrum help >/dev/null 113 ''; 114 115 passthru.updateScript = callPackage ./update.nix { }; 116 117 meta = with lib; { 118 description = "Lightweight Bitcoin wallet"; 119 longDescription = '' 120 An easy-to-use Bitcoin client featuring wallets generated from 121 mnemonic seeds (in addition to other, more advanced, wallet options) 122 and the ability to perform transactions without downloading a copy 123 of the blockchain. 124 ''; 125 homepage = "https://electrum.org/"; 126 downloadPage = "https://electrum.org/#download"; 127 changelog = "https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES"; 128 license = licenses.mit; 129 platforms = platforms.all; 130 maintainers = with maintainers; [ 131 joachifm 132 np 133 prusnak 134 ]; 135 mainProgram = "electrum"; 136 }; 137}