Skip to content

Commit

Permalink
electrum: fix build, update to 4.5.6 (NixOS#349753)
Browse files Browse the repository at this point in the history
  • Loading branch information
prusnak authored Oct 19, 2024
2 parents 9fd64fc + b3d9e85 commit 76e497c
Showing 1 changed file with 8 additions and 45 deletions.
53 changes: 8 additions & 45 deletions pkgs/applications/misc/electrum/default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, protobuf
, wrapQtAppsHook
, python3
, zbar
, secp256k1
, enableQt ? true
, callPackage
, qtwayland
, fetchPypi
}:

let
version = "4.5.5";

python = python3.override {
self = python;
packageOverrides = self: super: {
# Pin ledger-bitcoin to 0.2.1
ledger-bitcoin = super.ledger-bitcoin.overridePythonAttrs (oldAttrs: rec {
version = "0.2.1";
format = "pyproject";
src = fetchPypi {
pname = "ledger_bitcoin";
inherit version;
hash = "sha256-AWl/q2MzzspNIo6yf30S92PgM/Ygsb+1lJsg7Asztso=";
};
});
};
};

libsecp256k1_name =
if stdenv.hostPlatform.isLinux then "libsecp256k1.so.{v}"
else if stdenv.hostPlatform.isDarwin then "libsecp256k1.{v}.dylib"
Expand All @@ -41,39 +22,21 @@ let
else if stdenv.hostPlatform.isDarwin then "libzbar.0.dylib"
else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";

# Not provided in official source releases, which are what upstream signs.
tests = fetchFromGitHub {
owner = "spesmilo";
repo = "electrum";
rev = version;
sha256 = "sha256-CbhI/q+zjk9odxuvdzpogi046FqkedJooiQwS+WAkJ8=";

postFetch = ''
mv $out ./all
mv ./all/tests $out
'';
};

in

python.pkgs.buildPythonApplication {
python3.pkgs.buildPythonApplication rec {
pname = "electrum";
inherit version;
version = "4.5.6";

src = fetchurl {
url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
sha256 = "1jiagz9avkbd158pcip7p4wz0pdsxi94ndvg5p8afvshb32aqwav";
hash = "sha256-LO2ZUvbDJaIxrdgA+cM3sGgqJ+N+UlA9ObNINQcrorA=";
};

postUnpack = ''
# can't symlink, tests get confused
cp -ar ${tests} $sourceRoot/tests
'';

nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
build-system = [ protobuf ] ++ lib.optionals enableQt [ wrapQtAppsHook ];
buildInputs = lib.optional (stdenv.hostPlatform.isLinux && enableQt) qtwayland;

propagatedBuildInputs = with python.pkgs; [
dependencies = with python3.pkgs; [
aiohttp
aiohttp-socks
aiorpcx
Expand Down Expand Up @@ -104,7 +67,7 @@ python.pkgs.buildPythonApplication {
qdarkstyle
];

checkInputs = with python.pkgs; lib.optionals enableQt [
checkInputs = with python3.pkgs; lib.optionals enableQt [
pyqt6
];

Expand Down Expand Up @@ -136,7 +99,7 @@ python.pkgs.buildPythonApplication {
wrapQtApp $out/bin/electrum
'';

nativeCheckInputs = with python.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
nativeCheckInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];

pytestFlagsArray = [ "tests" ];

Expand Down

0 comments on commit 76e497c

Please sign in to comment.