2021-04-05 15:23:46 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchurl
|
|
|
|
, fetchFromGitHub
|
2021-12-26 17:43:05 +00:00
|
|
|
, fetchpatch
|
2020-08-20 17:08:02 +00:00
|
|
|
, wrapQtAppsHook
|
|
|
|
, python3
|
|
|
|
, zbar
|
|
|
|
, secp256k1
|
|
|
|
, enableQt ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
# for updater.nix
|
|
|
|
, writeScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, bash
|
|
|
|
, coreutils
|
|
|
|
, curl
|
|
|
|
, gnugrep
|
|
|
|
, gnupg
|
|
|
|
, gnused
|
|
|
|
, nix
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "4.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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"
|
2022-08-12 12:06:08 +00:00
|
|
|
else if stdenv.isDarwin then "libzbar.0.dylib"
|
2020-04-24 23:36:52 +00:00
|
|
|
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;
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-/bYz2KB9Fggo6cnKM3hvwL/Jy4Xsw2phx1sInuqZpFg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postFetch = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
mv $out ./all
|
|
|
|
mv ./all/electrum/tests $out
|
|
|
|
'';
|
|
|
|
};
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
python3.pkgs.buildPythonApplication {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "electrum";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-E941wseIQEn1+d06NWKQLQM0C+A8a0+Xxl+LzBTwEcw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
# can't symlink, tests get confused
|
|
|
|
cp -ar ${tests} $sourceRoot/electrum/tests
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
2020-04-24 23:36:52 +00:00
|
|
|
aiohttp
|
|
|
|
aiohttp-socks
|
2020-08-20 17:08:02 +00:00
|
|
|
aiorpcx
|
|
|
|
attrs
|
|
|
|
bitstring
|
2020-12-25 13:55:36 +00:00
|
|
|
cryptography
|
2020-04-24 23:36:52 +00:00
|
|
|
dnspython
|
|
|
|
jsonrpclib-pelix
|
|
|
|
matplotlib
|
|
|
|
pbkdf2
|
|
|
|
protobuf
|
|
|
|
pysocks
|
|
|
|
qrcode
|
|
|
|
requests
|
|
|
|
tlslite-ng
|
|
|
|
# plugins
|
2021-04-05 15:23:46 +00:00
|
|
|
btchip
|
2020-04-24 23:36:52 +00:00
|
|
|
ckcc-protocol
|
|
|
|
keepkey
|
|
|
|
trezor
|
2021-08-05 21:33:18 +00:00
|
|
|
] ++ lib.optionals enableQt [
|
|
|
|
pyqt5
|
|
|
|
qdarkstyle
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
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}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
'' else ''
|
|
|
|
sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
|
|
|
|
'');
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
postInstall = lib.optionalString stdenv.isLinux ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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"
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
postFixup = lib.optionalString enableQt ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapQtApp $out/bin/electrum
|
|
|
|
'';
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
checkInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
pytestFlagsArray = [ "electrum/tests" ];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_loop" # test tries to bind 127.0.0.1 causing permission error
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
postCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
$out/bin/electrum help >/dev/null
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.updateScript = import ./update.nix {
|
2021-02-05 17:12:51 +00:00
|
|
|
inherit lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit
|
|
|
|
writeScript
|
|
|
|
common-updater-scripts
|
|
|
|
bash
|
|
|
|
coreutils
|
|
|
|
curl
|
|
|
|
gnupg
|
|
|
|
gnugrep
|
|
|
|
gnused
|
|
|
|
nix
|
|
|
|
;
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A lightweight Bitcoin wallet";
|
|
|
|
longDescription = ''
|
|
|
|
An easy-to-use Bitcoin client featuring wallets generated from
|
|
|
|
mnemonic seeds (in addition to other, more advanced, wallet options)
|
|
|
|
and the ability to perform transactions without downloading a copy
|
|
|
|
of the blockchain.
|
|
|
|
'';
|
|
|
|
homepage = "https://electrum.org/";
|
2021-07-24 12:14:16 +00:00
|
|
|
downloadPage = "https://electrum.org/#download";
|
|
|
|
changelog = "https://github.com/spesmilo/electrum/blob/master/RELEASE-NOTES";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
2021-03-23 19:22:30 +00:00
|
|
|
maintainers = with maintainers; [ joachifm np prusnak ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|