12 , common-updater-scripts
26 if stdenv.isLinux then "libsecp256k1.so.0"
27 else if stdenv.isDarwin then "libsecp256k1.0.dylib"
28 else "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
31 if stdenv.isLinux then "libzbar.so.0"
32 else if stdenv.isDarwin then "libzbar.0.dylib"
33 else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
35 # Not provided in official source releases, which are what upstream signs.
36 tests = fetchFromGitHub {
40 sha256 = "sha256-z2/UamKmBq/5a0PTbHdAqGK617Lc8xRhHRpbCc7jeZo=";
44 mv ./all/electrum/tests $out
50 python3.pkgs.buildPythonApplication {
55 url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
56 sha256 = "sha256-vTZArTwbKcf6/vPQOvjubPecsg+h+QlZ6rdbl6qNfs0=";
60 # can't symlink, tests get confused
61 cp -ar ${tests} $sourceRoot/electrum/tests
64 nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
66 propagatedBuildInputs = with python3.pkgs; [
87 ] ++ lib.optionals enableQt [
93 # make compatible with protobuf4 by easing dependencies ...
94 substituteInPlace ./contrib/requirements/requirements.txt \
95 --replace "protobuf>=3.12,<4" "protobuf>=3.12"
96 # ... and regenerating the paymentrequest_pb2.py file
97 protoc --python_out=. electrum/paymentrequest.proto
99 substituteInPlace ./electrum/ecc_fast.py \
100 --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
101 '' + (if enableQt then ''
102 substituteInPlace ./electrum/qrscanner.py \
103 --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
105 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
108 postInstall = lib.optionalString stdenv.isLinux ''
109 substituteInPlace $out/share/applications/electrum.desktop \
110 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum %u"' \
111 "Exec=$out/bin/electrum %u" \
112 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum --testnet %u"' \
113 "Exec=$out/bin/electrum --testnet %u"
116 postFixup = lib.optionalString enableQt ''
117 wrapQtApp $out/bin/electrum
120 checkInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
122 pytestFlagsArray = [ "electrum/tests" ];
125 $out/bin/electrum help >/dev/null
128 passthru.updateScript = import ./update.nix {
132 common-updater-scripts
144 description = "A lightweight Bitcoin wallet";
146 An easy-to-use Bitcoin client featuring wallets generated from
147 mnemonic seeds (in addition to other, more advanced, wallet options)
148 and the ability to perform transactions without downloading a copy
151 homepage = "https://electrum.org/";
152 downloadPage = "https://electrum.org/#download";
153 changelog = "https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES";
154 license = licenses.mit;
155 platforms = platforms.all;
156 maintainers = with maintainers; [ joachifm np prusnak ];