flclash: init at 0.8.66

This commit is contained in:
dr56ekgbb 2024-10-26 08:25:17 +08:00
parent 0752b0e37e
commit ef08fafbea
2 changed files with 1842 additions and 0 deletions

View File

@ -0,0 +1,96 @@
{
lib,
fetchFromGitHub,
flutter,
keybinder3,
libayatana-appindicator,
buildGoModule,
makeDesktopItem,
copyDesktopItems,
}:
let
pname = "flclash";
version = "0.8.66";
src =
(fetchFromGitHub {
owner = "chen08209";
repo = "FlClash";
rev = "v${version}";
hash = "sha256-LkaAALJcP3DGXBMZ3QWLUiyT9Kr4yTxKIRqYhrW1WOw=";
fetchSubmodules = true;
}).overrideAttrs
(_: {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "git@github.com:";
});
libclash = buildGoModule {
inherit pname version src;
modRoot = "./core";
vendorHash = "sha256-K+PrLFvDHyaxf1NKzcqf0qmfQwT8rctScv1CN+TxY0M=";
buildPhase = ''
runHook preBuild
mkdir -p $out/lib
go build -ldflags="-w -s" -tags=with_gvisor -buildmode=c-shared -o $out/lib/libclash.so
runHook postBuild
'';
};
in
flutter.buildFlutterApplication {
inherit pname version src;
desktopItems = [
(makeDesktopItem {
name = "FlClash";
exec = "FlClash %U";
icon = "FlClash";
genericName = "FlClash";
desktopName = "FlClash";
categories = [
"Network"
];
keywords = [
"FlClash"
"Clash"
"ClashMeta"
"Proxy"
];
})
];
patchPhase = ''
runHook prePatch
substituteInPlace lib/clash/core.dart --replace-fail 'DynamicLibrary.open("libclash.so")' 'DynamicLibrary.open("${libclash}/lib/libclash.so")'
runHook postPatch
'';
preBuild = ''
mkdir -p ./libclash/linux/
cp ${libclash}/lib/libclash.so ./libclash/linux/libclash.so
'';
postInstall = ''
mkdir -p $out/share/pixmaps/
cp ./assets/images/icon.png $out/share/pixmaps/FlClash.png
'';
pubspecLock = lib.importJSON ./pubspec.lock.json;
nativeBuildInputs = [
copyDesktopItems
];
buildInputs = [
keybinder3
libayatana-appindicator
];
meta = {
description = "Multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free";
homepage = "https://github.com/chen08209/FlClash";
mainProgram = "FlClash";
license = with lib.licenses; [ gpl3Plus ];
maintainers = with lib.maintainers; [ aucub ];
platforms = lib.platforms.linux;
};
}

File diff suppressed because it is too large Load Diff