17 if stdenv.isLinux then "libsecp256k1.so.{v}"
18 else if stdenv.isDarwin then "libsecp256k1.{v}.dylib"
19 else "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
22 if stdenv.isLinux then "libzbar.so.0"
23 else if stdenv.isDarwin then "libzbar.0.dylib"
24 else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
26 # Not provided in official source releases, which are what upstream signs.
27 tests = fetchFromGitHub {
31 sha256 = "sha256-nd435CgF0a6JOni/OXcxkciVCR1aQqzfGfDSg1gPQ8Q=";
35 mv ./all/electrum/tests $out
41 python3.pkgs.buildPythonApplication {
46 url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
47 sha256 = "sha256-BxxC1xVKToUjgBo4mEeK9Tdhbd/+doHcTTJsXDtaELg=";
51 # can't symlink, tests get confused
52 cp -ar ${tests} $sourceRoot/electrum/tests
55 nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
57 propagatedBuildInputs = with python3.pkgs; [
79 ] ++ lib.optionals enableQt [
85 # make compatible with protobuf4 by easing dependencies ...
86 substituteInPlace ./contrib/requirements/requirements.txt \
87 --replace "protobuf>=3.20,<4" "protobuf>=3.20"
88 # ... and regenerating the paymentrequest_pb2.py file
89 protoc --python_out=. electrum/paymentrequest.proto
91 substituteInPlace ./electrum/ecc_fast.py \
92 --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
93 '' + (if enableQt then ''
94 substituteInPlace ./electrum/qrscanner.py \
95 --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
97 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
100 postInstall = lib.optionalString stdenv.isLinux ''
101 substituteInPlace $out/share/applications/electrum.desktop \
102 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum %u"' \
103 "Exec=$out/bin/electrum %u" \
104 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum --testnet %u"' \
105 "Exec=$out/bin/electrum --testnet %u"
108 postFixup = lib.optionalString enableQt ''
109 wrapQtApp $out/bin/electrum
112 nativeCheckInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
114 pytestFlagsArray = [ "electrum/tests" ];
117 $out/bin/electrum help >/dev/null
120 passthru.updateScript = callPackage ./update.nix { };
123 description = "Lightweight Bitcoin wallet";
125 An easy-to-use Bitcoin client featuring wallets generated from
126 mnemonic seeds (in addition to other, more advanced, wallet options)
127 and the ability to perform transactions without downloading a copy
130 homepage = "https://electrum.org/";
131 downloadPage = "https://electrum.org/#download";
132 changelog = "https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES";
133 license = licenses.mit;
134 platforms = platforms.all;
135 maintainers = with maintainers; [ joachifm np prusnak ];