17 if stdenv.hostPlatform.isLinux then
19 else if stdenv.hostPlatform.isDarwin then
20 "libsecp256k1.{v}.dylib"
22 "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
25 if stdenv.hostPlatform.isLinux then
27 else if stdenv.hostPlatform.isDarwin then
30 "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
34 python3.pkgs.buildPythonApplication rec {
39 url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
40 hash = "sha256-3YWVoTgTLe6Hzuds52Ch1iL8L9ZdO2rH335Tt/tup+g=";
43 build-system = [ protobuf ] ++ lib.optionals enableQt [ wrapQtAppsHook ];
44 buildInputs = lib.optional (stdenv.hostPlatform.isLinux && enableQt) qtwayland;
75 ++ lib.optionals enableQt [
82 lib.optionals enableQt [
88 # make compatible with protobuf4 by easing dependencies ...
89 substituteInPlace ./contrib/requirements/requirements.txt \
90 --replace "protobuf>=3.20,<4" "protobuf>=3.20"
91 # ... and regenerating the paymentrequest_pb2.py file
92 protoc --python_out=. electrum/paymentrequest.proto
94 substituteInPlace ./electrum/ecc_fast.py \
95 --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
100 substituteInPlace ./electrum/qrscanner.py \
101 --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
105 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
109 postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
110 substituteInPlace $out/share/applications/electrum.desktop \
111 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum %u"' \
112 "Exec=$out/bin/electrum %u" \
113 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum --testnet %u"' \
114 "Exec=$out/bin/electrum --testnet %u"
117 postFixup = lib.optionalString enableQt ''
118 wrapQtApp $out/bin/electrum
121 nativeCheckInputs = with python3.pkgs; [
127 pytestFlagsArray = [ "tests" ];
130 $out/bin/electrum help >/dev/null
133 passthru.updateScript = callPackage ./update.nix { };
136 description = "Lightweight Bitcoin wallet";
138 An easy-to-use Bitcoin client featuring wallets generated from
139 mnemonic seeds (in addition to other, more advanced, wallet options)
140 and the ability to perform transactions without downloading a copy
143 homepage = "https://electrum.org/";
144 downloadPage = "https://electrum.org/#download";
145 changelog = "https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES";
146 license = licenses.mit;
147 platforms = platforms.all;
148 maintainers = with maintainers; [
154 mainProgram = "electrum";