18 if stdenv.hostPlatform.isLinux then
20 else if stdenv.hostPlatform.isDarwin then
21 "libsecp256k1.0.dylib"
23 "libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}";
26 if stdenv.hostPlatform.isLinux then
28 else if stdenv.hostPlatform.isDarwin then
31 "libzbar${stdenv.hostPlatform.extensions.sharedLibrary}";
33 # Not provided in official source releases, which are what upstream signs.
34 tests = fetchFromGitHub {
36 repo = "electrum-ltc";
38 sha256 = "sha256-qu72LIV07pgHqvKv+Kcw9ZmNk6IBz+4/vdJELlT5tE4=";
42 mv ./all/electrum_ltc/tests $out
48 python3.pkgs.buildPythonApplication {
49 pname = "electrum-ltc";
53 url = "https://electrum-ltc.org/download/Electrum-LTC-${version}.tar.gz";
54 sha256 = "sha256-7F28cve+HD5JDK5igfkGD/NvTCfA33g+DmQJ5mwPM9Q=";
58 # can't symlink, tests get confused
59 cp -ar ${tests} $sourceRoot/electrum_ltc/tests
62 nativeBuildInputs = lib.optionals enableQt [ wrapQtAppsHook ];
64 propagatedBuildInputs =
89 ++ lib.optionals enableQt [
95 # electrum-ltc attempts to pin to aiorpcX < 0.23, but nixpkgs
96 # has moved to newer versions.
98 # electrum-ltc hasn't been updated in some time, so we replicate
99 # the patch from electrum (BTC) and alter it to be usable with
102 # Similar to the BTC patch, we need to overwrite the symlink
103 # at electrum_ltc/electrum-ltc with the patched run_electrum
105 ./ltc-aiorpcX-version-bump.patch
109 # copy the patched `/run_electrum` over `/electrum/electrum`
110 # so the aiorpcx compatibility patch is used
111 cp run_electrum electrum_ltc/electrum-ltc
116 sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
117 substituteInPlace ./electrum_ltc/ecc_fast.py \
118 --replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
123 substituteInPlace ./electrum_ltc/qrscanner.py \
124 --replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
128 sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
132 postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
133 # Despite setting usr_share above, these files are installed under
135 mv $out/${python3.sitePackages}/nix/store"/"*/share $out
136 rm -rf $out/${python3.sitePackages}/nix
138 substituteInPlace $out/share/applications/electrum-ltc.desktop \
139 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-ltc %u"' \
140 "Exec=$out/bin/electrum-ltc %u" \
141 --replace 'Exec=sh -c "PATH=\"\\$HOME/.local/bin:\\$PATH\"; electrum-ltc --testnet %u"' \
142 "Exec=$out/bin/electrum-ltc --testnet %u"
146 postFixup = lib.optionalString enableQt ''
147 wrapQtApp $out/bin/electrum-ltc
150 nativeCheckInputs = with python3.pkgs; [
155 buildInputs = lib.optional stdenv.hostPlatform.isLinux qtwayland;
157 pytestFlagsArray = [ "electrum_ltc/tests" ];
160 "test_loop" # test tries to bind 127.0.0.1 causing permission error
161 "test_is_ip_address" # fails spuriously https://github.com/spesmilo/electrum/issues/7307
162 # electrum_ltc.lnutil.RemoteMisbehaving: received commitment_signed without pending changes
163 "test_reestablish_replay_messages_rev_then_sig"
164 "test_reestablish_replay_messages_sig_then_rev"
166 "test_reestablish_with_old_state"
170 $out/bin/electrum-ltc help >/dev/null
174 description = "Lightweight Litecoin Client";
175 mainProgram = "electrum-ltc";
177 Electrum-LTC is a simple, but powerful Litecoin wallet. A unique secret
178 phrase (or “seed”) leaves intruders stranded and your peace of mind
179 intact. Keep it on paper, or in your head... and never worry about losing
180 your litecoins to theft or hardware failure.
182 homepage = "https://electrum-ltc.org/";
183 license = licenses.mit;
184 platforms = platforms.all;
185 maintainers = with maintainers; [ bbjubjub ];