2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2021-12-03 19:50:42 +00:00
|
|
|
, stdenv
|
2017-05-05 19:44:28 +00:00
|
|
|
, fetchurl
|
2021-12-03 19:50:42 +00:00
|
|
|
, fetchFromGitHub
|
2020-07-30 15:40:47 +00:00
|
|
|
, wrapQtAppsHook
|
2021-12-03 19:50:42 +00:00
|
|
|
, python3
|
|
|
|
, zbar
|
|
|
|
, secp256k1
|
|
|
|
, enableQt ? true
|
2017-05-05 19:44:28 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-03 19:50:42 +00:00
|
|
|
let
|
2022-07-19 08:11:57 +00:00
|
|
|
version = "4.2.2.1";
|
2021-12-03 19:50:42 +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-26 14:13:37 +00:00
|
|
|
else if stdenv.isDarwin then "libzbar.0.dylib"
|
2021-12-03 19:50:42 +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-07-19 08:11:57 +00:00
|
|
|
sha256 = "sha256-qu72LIV07pgHqvKv+Kcw9ZmNk6IBz+4/vdJELlT5tE4=";
|
2021-12-03 19:50:42 +00:00
|
|
|
|
2022-05-17 19:10:33 +00:00
|
|
|
postFetch = ''
|
2021-12-03 19:50:42 +00:00
|
|
|
mv $out ./all
|
|
|
|
mv ./all/electrum_ltc/tests $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
python3.pkgs.buildPythonApplication {
|
2019-02-15 09:08:27 +00:00
|
|
|
pname = "electrum-ltc";
|
2021-12-03 19:50:42 +00:00
|
|
|
inherit version;
|
2017-05-05 19:44:28 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://electrum-ltc.org/download/Electrum-LTC-${version}.tar.gz";
|
2022-07-19 08:11:57 +00:00
|
|
|
sha256 = "sha256-7F28cve+HD5JDK5igfkGD/NvTCfA33g+DmQJ5mwPM9Q=";
|
2017-05-05 19:44:28 +00:00
|
|
|
};
|
|
|
|
|
2021-12-03 19:50:42 +00:00
|
|
|
postUnpack = ''
|
|
|
|
# can't symlink, tests get confused
|
|
|
|
cp -ar ${tests} $sourceRoot/electrum_ltc/tests
|
|
|
|
'';
|
2019-02-15 09:08:27 +00:00
|
|
|
|
2021-12-03 19:50:42 +00:00
|
|
|
nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
|
|
|
|
|
2022-07-19 08:11:57 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
2021-12-03 19:50:42 +00:00
|
|
|
aiohttp
|
|
|
|
aiohttp-socks
|
|
|
|
aiorpcx
|
|
|
|
attrs
|
|
|
|
bitstring
|
|
|
|
cryptography
|
2017-12-10 14:27:06 +00:00
|
|
|
dnspython
|
2018-01-09 15:59:05 +00:00
|
|
|
jsonrpclib-pelix
|
2021-12-03 19:50:42 +00:00
|
|
|
matplotlib
|
|
|
|
pbkdf2
|
|
|
|
protobuf
|
|
|
|
py_scrypt
|
2017-12-27 11:48:11 +00:00
|
|
|
pysocks
|
2021-12-03 19:50:42 +00:00
|
|
|
qrcode
|
|
|
|
requests
|
|
|
|
tlslite-ng
|
|
|
|
# plugins
|
2023-03-03 18:36:49 +00:00
|
|
|
btchip-python
|
2021-12-03 19:50:42 +00:00
|
|
|
ckcc-protocol
|
|
|
|
keepkey
|
|
|
|
trezor
|
|
|
|
] ++ lib.optionals enableQt [
|
|
|
|
pyqt5
|
|
|
|
qdarkstyle
|
2017-05-05 19:44:28 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
|
2021-12-03 19:50:42 +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"
|
|
|
|
|
2017-05-05 19:44:28 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-03 19:50:42 +00:00
|
|
|
postFixup = lib.optionalString enableQt ''
|
|
|
|
wrapQtApp $out/bin/electrum-ltc
|
2020-07-30 15:40:47 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = with python3.pkgs; [ pytestCheckHook pyaes pycryptodomex ];
|
2021-12-03 19:50:42 +00:00
|
|
|
|
|
|
|
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 = ''
|
2017-05-05 19:44:28 +00:00
|
|
|
$out/bin/electrum-ltc help >/dev/null
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-12-03 19:50:42 +00:00
|
|
|
description = "Lightweight Litecoin Client";
|
2017-05-05 19:44:28 +00:00
|
|
|
longDescription = ''
|
2021-12-03 19:50:42 +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.
|
2017-05-05 19:44:28 +00:00
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://electrum-ltc.org/";
|
2017-05-05 19:44:28 +00:00
|
|
|
license = licenses.mit;
|
2021-12-03 19:50:42 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ lourkeur ];
|
2017-05-05 19:44:28 +00:00
|
|
|
};
|
|
|
|
}
|