nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 146 lines 3.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 wrapQtAppsHook, 6 python3, 7 zbar, 8 secp256k1, 9 enableQt ? true, 10 qtwayland, 11}: 12 13let 14 version = "4.5.4"; 15 16 libsecp256k1_name = 17 if stdenv.hostPlatform.isLinux then 18 "libsecp256k1.so.{v}" 19 else if stdenv.hostPlatform.isDarwin then 20 "libsecp256k1.{v}.dylib" 21 else 22 "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}"; 23 24 libzbar_name = 25 if stdenv.hostPlatform.isLinux then 26 "libzbar.so.0" 27 else if stdenv.hostPlatform.isDarwin then 28 "libzbar.0.dylib" 29 else 30 "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}"; 31 32in 33 34python3.pkgs.buildPythonApplication { 35 pname = "electrum-grs"; 36 inherit version; 37 format = "setuptools"; 38 39 src = fetchFromGitHub { 40 owner = "Groestlcoin"; 41 repo = "electrum-grs"; 42 rev = "refs/tags/v${version}"; 43 sha256 = "1k078jg3bw4n3kcxy917m30x1skxm679w8hcw8mlxb94ikrjc66h"; 44 }; 45 46 nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ]; 47 buildInputs = lib.optional (stdenv.hostPlatform.isLinux && enableQt) qtwayland; 48 49 propagatedBuildInputs = 50 with python3.pkgs; 51 [ 52 aiohttp 53 aiohttp-socks 54 aiorpcx 55 attrs 56 bitstring 57 cryptography 58 dnspython 59 groestlcoin-hash 60 jsonrpclib-pelix 61 matplotlib 62 pbkdf2 63 protobuf 64 pysocks 65 qrcode 66 requests 67 certifi 68 jsonpatch 69 # plugins 70 btchip-python 71 ledger-bitcoin 72 ckcc-protocol 73 keepkey 74 trezor 75 bitbox02 76 cbor 77 pyserial 78 ] 79 ++ lib.optionals enableQt [ 80 pyqt5 81 qdarkstyle 82 ]; 83 84 checkInputs = 85 with python3.pkgs; 86 lib.optionals enableQt [ 87 pyqt6 88 ]; 89 90 postPatch = '' 91 # make compatible with protobuf4 by easing dependencies ... 92 substituteInPlace ./contrib/requirements/requirements.txt \ 93 --replace "protobuf>=3.20,<4" "protobuf>=3.20" 94 # ... and regenerating the paymentrequest_pb2.py file 95 protoc --python_out=. electrum_grs/paymentrequest.proto 96 97 substituteInPlace ./electrum_grs/ecc_fast.py \ 98 --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary} 99 '' 100 + ( 101 if enableQt then 102 '' 103 substituteInPlace ./electrum_grs/qrscanner.py \ 104 --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary} 105 '' 106 else 107 '' 108 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt 109 '' 110 ); 111 112 postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' 113 substituteInPlace $out/share/applications/electrum-grs.desktop \ 114 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-grs %u"' \ 115 "Exec=$out/bin/electrum-grs %u" \ 116 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-grs --testnet %u"' \ 117 "Exec=$out/bin/electrum-grs --testnet %u" 118 ''; 119 120 postFixup = lib.optionalString enableQt '' 121 wrapQtApp $out/bin/electrum-grs 122 ''; 123 124 # the tests are currently broken 125 doCheck = false; 126 127 postCheck = '' 128 $out/bin/electrum-grs help >/dev/null 129 ''; 130 131 meta = with lib; { 132 description = "Lightweight Groestlcoin wallet"; 133 longDescription = '' 134 An easy-to-use Groestlcoin client featuring wallets generated from 135 mnemonic seeds (in addition to other, more advanced, wallet options) 136 and the ability to perform transactions without downloading a copy 137 of the blockchain. 138 ''; 139 homepage = "https://groestlcoin.org/"; 140 downloadPage = "https://github.com/Groestlcoin/electrum-grs/releases/tag/v{version}"; 141 license = licenses.mit; 142 platforms = platforms.all; 143 maintainers = with maintainers; [ gruve-p ]; 144 mainProgram = "electrum-grs"; 145 }; 146}