-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c9fd3e
commit 92f45ac
Showing
4 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13080,6 +13080,13 @@ | |
githubId = 74221543; | ||
name = "Moritz Goltdammer"; | ||
}; | ||
linuxwhata = { | ||
email = "[email protected]"; | ||
matrix = "@lwa:envs.net"; | ||
github = "linuxwhata"; | ||
githubId = 68576488; | ||
name = "Zhou Ke"; | ||
}; | ||
lionello = { | ||
email = "[email protected]"; | ||
github = "lionello"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
lib, | ||
dpkg, | ||
stdenv, | ||
fetchurl, | ||
buildFHSEnv, | ||
autoPatchelfHook, | ||
writeShellScript, | ||
zenity, | ||
nss, | ||
gtk2, | ||
alsa-lib, | ||
dbus-glib, | ||
libXtst, | ||
libXdamage, | ||
libXScrnSaver, | ||
}: | ||
|
||
let | ||
sources = import ./sources.nix; | ||
|
||
xunlei = stdenv.mkDerivation rec { | ||
pname = "xunlei"; | ||
version = sources.version; | ||
|
||
src = | ||
{ | ||
x86_64-linux = fetchurl { | ||
url = sources.amd64_url; | ||
hash = sources.amd64_hash; | ||
}; | ||
aarch64-linux = fetchurl { | ||
url = sources.arm64_url; | ||
hash = sources.arm64_hash; | ||
}; | ||
loongarch64-linux = fetchurl { | ||
url = sources.loongarch64_url; | ||
hash = sources.loongarch64_hash; | ||
}; | ||
} | ||
.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); | ||
|
||
buildInputs = [ | ||
nss | ||
gtk2 | ||
alsa-lib | ||
dbus-glib | ||
libXtst | ||
libXdamage | ||
libXScrnSaver | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
dpkg | ||
autoPatchelfHook | ||
]; | ||
|
||
installPhase = '' | ||
mkdir -p $out/{lib,share} | ||
cp -r opt/apps/com.xunlei.download/files/* $out/lib | ||
cp -r opt/apps/com.xunlei.download/entries/* $out/share | ||
mv $out/share/icons/hicolor/scalable/apps/com.thunder.download.svg \ | ||
$out/share/icons/hicolor/scalable/apps/com.xunlei.download.svg | ||
sed -e 's|^Exec=.*|Exec=${pname} %U --no-sandbox|' \ | ||
-e 's|^Icon=.*|Icon=com.xunlei.download|' \ | ||
-e 's|^Categories=.*|Categories=Network|' \ | ||
-i $out/share/applications/com.xunlei.download.desktop | ||
''; | ||
|
||
meta = with lib; { | ||
description = "xunlei download"; | ||
homepage = "https://www.xunlei.com"; | ||
license = licenses.unfree; | ||
platforms = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
"loongarch64-linux" | ||
]; | ||
}; | ||
}; | ||
in | ||
buildFHSEnv { | ||
inherit (xunlei) pname version meta; | ||
runScript = writeShellScript "xunlei-launcher" '' | ||
exec ${xunlei}/lib/thunder -start $1 "$@" | ||
''; | ||
extraInstallCommands = '' | ||
mkdir -p $out | ||
ln -s ${xunlei}/share $out | ||
''; | ||
|
||
passthru.updateScript = ./update.sh; | ||
|
||
includeClosures = true; | ||
targetPkgs = pkgs: [ zenity ]; # system tray click events | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Generated by ./update.sh - do not update manually! | ||
# Last updated: 2025-01-10 | ||
{ | ||
version = "1.0.0.5"; | ||
amd64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_amd64.deb"; | ||
arm64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_arm64.deb"; | ||
loongarch64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_1.0.0.5_loongarch64.deb"; | ||
amd64_hash = "sha256-K+eHPmG2tT5Z+RWxigg03itw6Rcnk5MZlODqS/JtAnk="; | ||
arm64_hash = "sha256-iA9mbp0wSe66qC5lphMTFPzmOJjzHfWKubGRPiKcVdg="; | ||
loongarch64_hash = "sha256-44QPnB/1uWHaQkd3DBMDvYXfXwch9HywZUvg71z8fts="; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#! /usr/bin/env nix-shell | ||
#! nix-shell -i bash --pure --keep GITHUB_TOKEN -p nix git curl cacert nix-prefetch-git gzip | ||
|
||
base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle/appstore/binary-" | ||
base_url_appendix="/Packages.gz" | ||
target_package="com.xunlei.download" | ||
packages_file="Packages.gz" | ||
|
||
url=() | ||
version=() # TODO: Currently, there is no version differences between archs. This is reserved for future use. | ||
hash=() | ||
|
||
for i in amd64 arm64 loongarch64 | ||
do | ||
current_url=$base_url_suffix$i$base_url_appendix | ||
curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0" -v -L -O $current_url | ||
current_version=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" ' | ||
BEGIN { found = 0 } | ||
{ | ||
if ($0 ~ "^Package: "pkg) { | ||
found = 1; | ||
} | ||
if (found && $1 == "Version:") { | ||
print $2; | ||
exit; | ||
} | ||
} | ||
') | ||
version+=("$current_version") | ||
sha256sum=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" ' | ||
BEGIN { found = 0 } | ||
{ | ||
if ($0 ~ "^Package: "pkg) { | ||
found = 1; | ||
} | ||
if (found && $1 == "SHA256:") { | ||
print $2; | ||
exit; | ||
} | ||
} | ||
') | ||
url+=("https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.xunlei.download/com.xunlei.download_"$version"_"$i".deb") | ||
hash+=("$(nix hash to-sri --type sha256 $sha256sum)") | ||
done | ||
|
||
cat >sources.nix <<EOF | ||
# Generated by ./update.sh - do not update manually! | ||
# Last updated: $(date +%F) | ||
{ | ||
version = "${version[0]}"; | ||
amd64_url = "${url[0]}"; | ||
arm64_url = "${url[1]}"; | ||
loongarch64_url = "${url[2]}"; | ||
amd64_hash = "${hash[0]}"; | ||
arm64_hash = "${hash[1]}"; | ||
loongarch64_hash = "${hash[2]}"; | ||
} | ||
EOF | ||
|
||
rm -r Packages.gz |