electrum: optional qt5 and darwin fixes

qt5 is often broken on darwin, and it's a massive closure when there's
a curses interface and CLI to use instead.
wip/yesman
arcnmx 5 years ago
parent 769f992fbc
commit 36f9da4ec4
  1. 30
      pkgs/applications/misc/electrum/default.nix

@ -1,4 +1,5 @@
{ stdenv, fetchurl, fetchFromGitHub, python3, python3Packages, zbar, secp256k1
, enableQt ? !stdenv.isDarwin
# for updater.nix
@ -16,6 +17,15 @@
let
version = "3.3.8";
libsecp256k1_name =
if stdenv.isLinux then "libsecp256k1.so.0"
else if stdenv.isDarwin then "libsecp256k1.0.dylib"
else "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
libzbar_name =
if stdenv.isLinux then "libzbar.so.0"
else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
# Not provided in official source releases, which are what upstream signs.
tests = fetchFromGitHub {
owner = "spesmilo";
@ -56,9 +66,7 @@ python3Packages.buildPythonApplication rec {
protobuf
pyaes
pycryptodomex
pyqt5
pysocks
qdarkstyle
qrcode
requests
tlslite-ng
@ -70,15 +78,20 @@ python3Packages.buildPythonApplication rec {
# TODO plugins
# amodem
];
] ++ stdenv.lib.optionals enableQt [ pyqt5 qdarkstyle ];
preBuild = ''
sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
sed -i "s|name = 'libzbar.*'|name='${zbar}/lib/libzbar.so'|" electrum/qrscanner.py
substituteInPlace ./electrum/ecc_fast.py --replace libsecp256k1.so.0 ${secp256k1}/lib/libsecp256k1.so.0
'';
postInstall = ''
substituteInPlace ./electrum/ecc_fast.py \
--replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
'' + (if enableQt then ''
substituteInPlace ./electrum/qrscanner.py \
--replace ${libzbar_name} ${zbar}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
'' else ''
sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
'');
postInstall = stdenv.lib.optionalString stdenv.isLinux ''
# Despite setting usr_share above, these files are installed under
# $out/nix ...
mv $out/${python3.sitePackages}/nix/store"/"*/share $out
@ -123,6 +136,7 @@ python3Packages.buildPythonApplication rec {
'';
homepage = https://electrum.org/;
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ ehmry joachifm np ];
};
}

Loading…
Cancel
Save