2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2021-12-06 16:07:01 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchFromGitHub
|
2020-09-25 04:45:31 +00:00
|
|
|
, wrapQtAppsHook
|
2021-12-06 16:07:01 +00:00
|
|
|
, python3
|
|
|
|
, zbar
|
|
|
|
, secp256k1
|
|
|
|
, enableQt ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
let
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "4.2.2.1";
|
2021-12-06 16:07:01 +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-12-28 21:21:41 +00:00
|
|
|
else if stdenv.isDarwin then "libzbar.0.dylib"
|
2021-12-06 16:07:01 +00:00
|
|
|
else "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
|
|
|
|
# Not provided in official source releases, which are what upstream signs.
|
|
|
|
tests = fetchFromGitHub {
|
|
|
|
owner = "pooler";
|
|
|
|
repo = "electrum-ltc";
|
|
|
|
rev = version;
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-qu72LIV07pgHqvKv+Kcw9ZmNk6IBz+4/vdJELlT5tE4=";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postFetch = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
mv $out ./all
|
|
|
|
mv ./all/electrum_ltc/tests $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
python3.pkgs.buildPythonApplication {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "electrum-ltc";
|
2021-12-06 16:07:01 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://electrum-ltc.org/download/Electrum-LTC-${version}.tar.gz";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-7F28cve+HD5JDK5igfkGD/NvTCfA33g+DmQJ5mwPM9Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postUnpack = ''
|
|
|
|
# can't symlink, tests get confused
|
|
|
|
cp -ar ${tests} $sourceRoot/electrum_ltc/tests
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
2021-12-06 16:07:01 +00:00
|
|
|
aiohttp
|
|
|
|
aiohttp-socks
|
|
|
|
aiorpcx
|
|
|
|
attrs
|
|
|
|
bitstring
|
|
|
|
cryptography
|
2020-04-24 23:36:52 +00:00
|
|
|
dnspython
|
|
|
|
jsonrpclib-pelix
|
2021-12-06 16:07:01 +00:00
|
|
|
matplotlib
|
|
|
|
pbkdf2
|
|
|
|
protobuf
|
|
|
|
py_scrypt
|
2020-04-24 23:36:52 +00:00
|
|
|
pysocks
|
2021-12-06 16:07:01 +00:00
|
|
|
qrcode
|
|
|
|
requests
|
|
|
|
tlslite-ng
|
|
|
|
# plugins
|
2020-11-03 02:18:15 +00:00
|
|
|
btchip
|
2021-12-06 16:07:01 +00:00
|
|
|
ckcc-protocol
|
|
|
|
keepkey
|
|
|
|
trezor
|
|
|
|
] ++ lib.optionals enableQt [
|
|
|
|
pyqt5
|
|
|
|
qdarkstyle
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
|
2021-12-06 16:07:01 +00:00
|
|
|
substituteInPlace ./electrum_ltc/ecc_fast.py \
|
|
|
|
--replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
'' + (if enableQt then ''
|
|
|
|
substituteInPlace ./electrum_ltc/qrscanner.py \
|
|
|
|
--replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
|
|
|
|
'' else ''
|
|
|
|
sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
|
|
|
|
'');
|
|
|
|
|
|
|
|
postInstall = lib.optionalString stdenv.isLinux ''
|
|
|
|
# Despite setting usr_share above, these files are installed under
|
|
|
|
# $out/nix ...
|
|
|
|
mv $out/${python3.sitePackages}/nix/store"/"*/share $out
|
|
|
|
rm -rf $out/${python3.sitePackages}/nix
|
|
|
|
|
|
|
|
substituteInPlace $out/share/applications/electrum-ltc.desktop \
|
|
|
|
--replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-ltc %u"' \
|
|
|
|
"Exec=$out/bin/electrum-ltc %u" \
|
|
|
|
--replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-ltc --testnet %u"' \
|
|
|
|
"Exec=$out/bin/electrum-ltc --testnet %u"
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postFixup = lib.optionalString enableQt ''
|
|
|
|
wrapQtApp $out/bin/electrum-ltc
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
checkInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
|
|
|
|
|
|
|
|
pytestFlagsArray = [ "electrum_ltc/tests" ];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_loop" # test tries to bind 127.0.0.1 causing permission error
|
|
|
|
"test_is_ip_address" # fails spuriously https://github.com/spesmilo/electrum/issues/7307
|
|
|
|
];
|
|
|
|
|
|
|
|
postCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
$out/bin/electrum-ltc help >/dev/null
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-12-06 16:07:01 +00:00
|
|
|
description = "Lightweight Litecoin Client";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
Electrum-LTC is a simple, but powerful Litecoin wallet. A unique secret
|
|
|
|
phrase (or “seed”) leaves intruders stranded and your peace of mind
|
|
|
|
intact. Keep it on paper, or in your head... and never worry about losing
|
|
|
|
your litecoins to theft or hardware failure.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
homepage = "https://electrum-ltc.org/";
|
|
|
|
license = licenses.mit;
|
2021-12-06 16:07:01 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ lourkeur ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|