Skip to content

Commit

Permalink
hiddify-app: 2.5.7-unstable-2024-11-18 -> 2.5.7-unstable-2024-12-30
Browse files Browse the repository at this point in the history
  • Loading branch information
aucub committed Jan 1, 2025
1 parent 0ae4367 commit 8e6a278
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions pkgs/by-name/hi/hiddify-app/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,41 @@
autoPatchelfHook,
}:
let
pname = "hiddify-app";
version = "2.5.7-unstable-2024-11-18";
src = fetchFromGitHub {
owner = "hiddify";
repo = "hiddify-app";
rev = "9d3de0ae2ea2687f189f75fa2a9196a035a0bb32";
hash = "sha256-P04A14lFfgvl0kkxMsNXNaHnwfJ3AWkhrfI7VMESGHc=";
fetchSubmodules = true;
metaCommon = {
description = "Multi-platform auto-proxy client, supporting Sing-box, X-ray, TUIC, Hysteria, Reality, Trojan, SSH etc";
license = with lib.licenses; [
unfree # upstream adds non-free additional conditions https://github.com/hiddify/hiddify-app/blob/0f6b15057f626016fcd7a0c075f1c8c2f606110a/LICENSE.md#additional-conditions-to-gpl-v3
gpl3Only
];
maintainers = with lib.maintainers; [ aucub ];
};
libcore = buildGoModule rec {
inherit pname version src;

modRoot = "./libcore";
libcore = buildGoModule rec {
pname = "hiddify-core";
version = "3.1.8";

src = fetchFromGitHub {
owner = "hiddify";
repo = "hiddify-core";
tag = "v${version}";
hash = "sha256-NRzzkC3xbRVP20Pm29bHf8YpxmnjISgF46c8l9qU4rA=";
};

vendorHash = "sha256-a7NFZt4/w2+oaZG3ncaOrrhASxUptcWS/TeaIQrgLe4=";

GO_PUBLIC_FLAGS = ''
GO_BUILD_FLAGS = ''
-tags "with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc" \
-trimpath \
-ldflags "-s -w" \
'';

postPatch = ''
sed -i '/import (/a\ \t"os"\n\t"path/filepath"' ./libcore/v2/db/hiddify_db.go
substituteInPlace ./libcore/v2/db/hiddify_db.go \
--replace-fail 'NewGoLevelDBWithOpts(name, "./data", ' 'NewGoLevelDBWithOpts(name, filepath.Join(os.Getenv("HOME"), ".local", "share", "app.hiddify.com", "data"), '
'';

buildPhase = ''
runHook preBuild
go build ${GO_PUBLIC_FLAGS} -buildmode=c-shared -o bin/lib/libcore.so ./custom
go build ${GO_BUILD_FLAGS} -buildmode=c-shared -o bin/lib/libcore.so ./custom
mkdir lib
cp bin/lib/libcore.so ./lib/libcore.so
CGO_LDFLAGS="./lib/libcore.so" go build ${GO_PUBLIC_FLAGS} -o bin/HiddifyCli ./cli/bydll
CGO_LDFLAGS="./lib/libcore.so" go build ${GO_BUILD_FLAGS} -o bin/HiddifyCli ./cli/bydll
runHook postBuild
'';
Expand All @@ -59,24 +59,24 @@ let
runHook postInstall
'';

meta = {
description = "Multi-platform auto-proxy client, supporting Sing-box, X-ray, TUIC, Hysteria, Reality, Trojan, SSH etc";
homepage = "https://hiddify.com";
meta = metaCommon // {
homepage = "https://github.com/hiddify/hiddify-core";
mainProgram = "HiddifyCli";
license = lib.licenses.cc-by-nc-sa-40;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ aucub ];
};
};
in
flutter324.buildFlutterApplication {
inherit pname version src;
pname = "hiddify-app";
version = "2.5.7-unstable-2024-12-30";

pubspecLock = lib.importJSON ./pubspec.lock.json;
src = fetchFromGitHub {
owner = "hiddify";
repo = "hiddify-app";
rev = "e5a1e1d6661039afcdef68406f978f3b6ef56412";
hash = "sha256-wZz19EQbnsHgZpnOT5egE3lpxYXQEJCcRSL9+kUET90=";
};

buildInputs = [
libayatana-appindicator
];
pubspecLock = lib.importJSON ./pubspec.lock.json;

nativeBuildInputs = [
pkg-config
Expand All @@ -85,12 +85,17 @@ flutter324.buildFlutterApplication {
copyDesktopItems
];

buildInputs = [
libayatana-appindicator
];

postPatch = ''
substituteInPlace ./linux/my_application.cc \
--replace-fail "./hiddify.png" "${placeholder "out"}/share/pixmaps/hiddify.png"
'';

preBuild = ''
mkdir -p libcore/bin
cp -r ${libcore}/lib libcore/bin/lib
cp ${libcore}/bin/HiddifyCli libcore/bin/HiddifyCli
packageRun build_runner build --delete-conflicting-outputs
Expand Down Expand Up @@ -135,19 +140,16 @@ flutter324.buildFlutterApplication {
};

extraWrapProgramArgs = ''
--prefix LD_LIBRARY_PATH : "$out/app/${pname}/lib"
--prefix LD_LIBRARY_PATH : "$out/app/hiddify-app/lib"
'';

preFixup = ''
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" $out/app/${pname}/lib/lib*.so
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" $out/app/hiddify-app/lib/lib*.so
'';

meta = {
description = "Multi-platform auto-proxy client, supporting Sing-box, X-ray, TUIC, Hysteria, Reality, Trojan, SSH etc";
meta = metaCommon // {
homepage = "https://hiddify.com";
mainProgram = "hiddify";
license = lib.licenses.cc-by-nc-sa-40;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ aucub ];
};
}

0 comments on commit 8e6a278

Please sign in to comment.