Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flclash: init at 0.8.66 #351318

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions pkgs/by-name/fl/flclash/package.nix
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]:";
});
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;
};
}
Loading