clash-verge-rev: 1.7.5 -> 1.7.7; clash-verge-rev: build from source; clash-verge-rev: add bot-wxt1221 as maintainers

This commit is contained in:
wxt 2024-08-20 13:36:42 +08:00
parent fe75bd4cb4
commit 766b1bc091
No known key found for this signature in database
GPG Key ID: 8281D5EE2D1825A4
5 changed files with 7806 additions and 46 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +1,103 @@
{
lib,
autoPatchelfHook,
clash-meta,
dpkg,
fetchurl,
libayatana-appindicator,
nix-update-script,
openssl,
mihomo,
callPackage,
fetchFromGitHub,
dbip-country-lite,
stdenv,
udev,
webkitgtk,
wrapGAppsHook3,
v2ray-geoip,
v2ray-domain-list-community,
}:
stdenv.mkDerivation (finalAttrs: {
let
pname = "clash-verge-rev";
version = "1.7.5";
version = "1.7.7";
src = fetchurl {
url = "https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v${finalAttrs.version}/clash-verge_${finalAttrs.version}_amd64.deb";
hash = "sha256-pVEP+A4W6xLShFXuXPA6P+HZT8Hqkj/HRW2LaOOBI6U=";
src = fetchFromGitHub {
owner = "clash-verge-rev";
repo = "clash-verge-rev";
rev = "v${version}";
hash = "sha256-5sd0CkUCV52wrBPo0IRIa1uqf2QNkjXuZhE33cZW3SY=";
};
nativeBuildInputs = [
dpkg
wrapGAppsHook3
autoPatchelfHook
];
src-service = fetchFromGitHub {
owner = "clash-verge-rev";
repo = "clash-verge-service";
rev = "e74e419f004275cbf35a427337d3f8c771408f07"; # no meaningful tags in this repo. The only way is updating manully every time.
hash = "sha256-HyRTOqPj4SnV9gktqRegxOYz9c8mQHOX+IrdZlHhYpo=";
};
buildInputs = [
openssl
webkitgtk
];
service-cargo-hash = "sha256-NBeHR6JvdCp06Ug/UEtLY2tu3iCmlsCU0x8umRbJXLU=";
runtimeDependencies = [
(lib.getLib udev)
libayatana-appindicator
];
service = callPackage ./service.nix {
inherit
version
src-service
service-cargo-hash
pname
;
};
installPhase = ''
runHook preInstall
webui = callPackage ./webui.nix {
inherit
version
src
pname
;
};
mkdir -p $out/bin
mv usr/* $out
sysproxy-hash = "sha256-TEC51s/viqXUoEH9rJev8LdC2uHqefInNcarxeogePk=";
runHook postInstall
'';
postFixup = ''
rm -f $out/bin/verge-mihomo
ln -sf ${lib.getExe clash-meta} $out/bin/verge-mihomo
'';
passthru.updateScript = nix-update-script { };
unwrapped = callPackage ./unwrapped.nix {
inherit
pname
version
src
sysproxy-hash
webui
meta
;
};
meta = {
description = "Clash GUI based on tauri";
homepage = "https://github.com/clash-verge-rev/clash-verge-rev";
license = lib.licenses.gpl3Plus;
license = lib.licenses.gpl3Only;
mainProgram = "clash-verge";
maintainers = with lib.maintainers; [ Guanran928 ];
platforms = [ "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with lib.maintainers; [
Guanran928
bot-wxt1221
];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
})
in
stdenv.mkDerivation {
inherit
pname
src
version
meta
;
nativeBuildInputs = [
wrapGAppsHook3
];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share,lib/clash-verge/resources}
cp -r ${unwrapped}/share/* $out/share
cp -r ${unwrapped}/bin/clash-verge $out/bin/clash-verge
# This can't be symbol linked. It will find mihomo in its runtime path
ln -s ${service}/bin/clash-verge-service $out/bin/clash-verge-service
ln -s ${mihomo}/bin/mihomo $out/bin/verge-mihomo
# people who want to use alpha build show override mihomo themselves. The alpha core entry was removed in clash-verge.
ln -s ${v2ray-geoip}/share/v2ray/geoip.dat $out/lib/clash-verge/resources/geoip.dat
ln -s ${v2ray-domain-list-community}/share/v2ray/geosite.dat $out/lib/clash-verge/resources/geosite.dat
ln -s ${dbip-country-lite.mmdb} $out/lib/clash-verge/resources/Country.mmdb
runHook postInstall
'';
}

View File

@ -0,0 +1,33 @@
{
version,
rustPlatform,
src-service,
pkg-config,
openssl,
pname,
webkitgtk,
service-cargo-hash,
}:
rustPlatform.buildRustPackage {
pname = "${pname}-service";
inherit version;
src = src-service;
sourceRoot = "${src-service.name}";
nativeBuildInputs = [
pkg-config
rustPlatform.cargoSetupHook
];
buildInputs = [
openssl
webkitgtk
];
env = {
OPENSSL_NO_VENDOR = 1;
};
cargoHash = service-cargo-hash;
}

View File

@ -0,0 +1,68 @@
{
pname,
version,
src,
libayatana-appindicator,
sysproxy-hash,
webui,
pkg-config,
rustPlatform,
makeDesktopItem,
meta,
webkitgtk,
openssl,
}:
rustPlatform.buildRustPackage {
inherit version src;
pname = "${pname}-unwrapped";
sourceRoot = "${src.name}/src-tauri";
cargoLock = {
lockFile = ./Cargo-tauri.lock;
outputHashes = {
"sysproxy-0.3.0" = sysproxy-hash;
};
};
env = {
OPENSSL_NO_VENDOR = 1;
};
postPatch = ''
substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
--replace "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
substituteInPlace ./tauri.conf.json \
--replace-fail '"distDir": "../dist",' '"distDir": "${webui}",' \
--replace-fail '"beforeBuildCommand": "pnpm run web:build"' '"beforeBuildCommand": ""'
sed -i -e '/externalBin/d' -e '/resources/d' tauri.conf.json
'';
nativeBuildInputs = [
pkg-config
rustPlatform.cargoSetupHook
];
buildInputs = [
openssl
webkitgtk
];
postInstall = ''
install -DT icons/128x128@2x.png $out/share/icons/hicolor/128x128@2/apps/clash-verge.png
install -DT icons/128x128.png $out/share/icons/hicolor/128x128/apps/clash-verge.png
install -DT icons/32x32.png $out/share/icons/hicolor/32x32/apps/clash-verge.png
'';
desktopItems = [
(makeDesktopItem {
name = "clash-verge-rev";
exec = "clash-verge %u";
icon = "clash-verge-rev";
desktopName = "Clash Verge Rev";
genericName = meta.description;
mimeTypes = [ "x-scheme-handler/clash" ];
type = "Application";
terminal = false;
})
];
}

View File

@ -0,0 +1,43 @@
{
version,
src,
pname,
pnpm,
nodejs,
stdenv,
}:
stdenv.mkDerivation {
inherit version src;
pname = "${pname}-webui";
pnpmDeps = pnpm.fetchDeps {
inherit pname version src;
hash = "sha256-DYsx1X1yXYEPFuMlvZtbJdefcCR8/wSUidFwsMy8oLk=";
};
nativeBuildInputs = [
nodejs
pnpm.configHook
];
postPatch = ''
chmod -R +644 -- ./src/components/setting/mods/clash-core-viewer.tsx
chmod -R +644 -- ./src/components/setting/mods
sed -i -e '/Mihomo Alpha/d' ./src/components/setting/mods/clash-core-viewer.tsx
'';
buildPhase = ''
runHook preBuild
node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
}