diff --git a/pkgs/applications/misc/electrum/default.nix b/pkgs/applications/misc/electrum/default.nix index 61819f15f3ac..5233aaf8fcdb 100644 --- a/pkgs/applications/misc/electrum/default.nix +++ b/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 - ''; + 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 = '' + 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 ]; }; }