Skip to content

Commit

Permalink
electrum: add patch for aiorpcx 0.24 compatibility (NixOS#380708)
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak authored Feb 10, 2025
2 parents fd2451f + e3d7bba commit dffcaa4
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pkgs/applications/misc/electrum/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,31 @@ python3.pkgs.buildPythonApplication rec {

postPatch =
''
# fix compatibility with recent aiorpcx version
# (remove as soon as https://github.com/spesmilo/electrum/commit/171aa5ee5ad4e25b9da10f757d9d398e905b4945 is included in source tarball)
substituteInPlace ./contrib/requirements/requirements.txt \
--replace-fail "aiorpcx>=0.22.0,<0.24" "aiorpcx>=0.22.0,<0.25"
substituteInPlace ./run_electrum \
--replace-fail "if not ((0, 22, 0) <= aiorpcx._version < (0, 24)):" "if not ((0, 22, 0) <= aiorpcx._version < (0, 25)):" \
--replace-fail "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.24" "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.25"
substituteInPlace ./electrum/electrum \
--replace-fail "if not ((0, 22, 0) <= aiorpcx._version < (0, 24)):" "if not ((0, 22, 0) <= aiorpcx._version < (0, 25)):" \
--replace-fail "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.24" "aiorpcX version {aiorpcx._version} does not match required: 0.22.0<=ver<0.25"
# make compatible with protobuf4 by easing dependencies ...
substituteInPlace ./contrib/requirements/requirements.txt \
--replace "protobuf>=3.20,<4" "protobuf>=3.20"
--replace-fail "protobuf>=3.20,<4" "protobuf>=3.20"
# ... and regenerating the paymentrequest_pb2.py file
protoc --python_out=. electrum/paymentrequest.proto
substituteInPlace ./electrum/ecc_fast.py \
--replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
--replace-fail ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
''
+ (
if enableQt then
''
substituteInPlace ./electrum/qrscanner.py \
--replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
--replace-fail ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
''
else
''
Expand All @@ -108,10 +119,8 @@ python3.pkgs.buildPythonApplication rec {

postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace $out/share/applications/electrum.desktop \
--replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum %u"' \
"Exec=$out/bin/electrum %u" \
--replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum --testnet %u"' \
"Exec=$out/bin/electrum --testnet %u"
--replace-fail "Exec=electrum %u" "Exec=$out/bin/electrum %u" \
--replace-fail "Exec=electrum --testnet %u" "Exec=$out/bin/electrum --testnet %u"
'';

postFixup = lib.optionalString enableQt ''
Expand Down

0 comments on commit dffcaa4

Please sign in to comment.