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

nekoray: 3.26 -> 4.0.1 #368385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions pkgs/by-name/ne/nekoray/nekobox-core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ buildGoModule rec {

postPatch = ''
cp -r --no-preserve=all ${extraSources.libneko} ../../../../libneko
cp -r --no-preserve=all ${extraSources.sing-box-extra} ../../../../sing-box-extra
cp -r --no-preserve=all ${extraSources.sing-box} ../../../../sing-box
cp -r --no-preserve=all ${extraSources.sing-quic} ../../../../sing-quic
'';

vendorHash = "sha256-q/Co67AwJVElJnEY2O0SLLUzwlGiqazKu+fD/nnbrTk=";
vendorHash = "sha256-eHqCu0pmvITqGF5hs7mj2IcAU0wSTBjh/7kQ3en+gEY=";

ldflags = [
"-w"
Expand Down
26 changes: 0 additions & 26 deletions pkgs/by-name/ne/nekoray/nekoray-core.nix

This file was deleted.

75 changes: 28 additions & 47 deletions pkgs/by-name/ne/nekoray/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
stdenv,
fetchFromGitHub,
libsForQt5,

cmake,
ninja,

protobuf,
yaml-cpp,
zxing-cpp,

callPackage,
makeDesktopItem,
copyDesktopItems,
makeDesktopItem,

v2ray-geoip,
v2ray-domain-list-community,
Expand All @@ -31,32 +34,20 @@ let

extraSources = {
# revs found in https://github.com/MatsuriDayo/nekoray/blob/<version>/libs/get_source_env.sh
Xray-core = fetchSource {
name = "Xray-core";
rev = "01208225ee7e508044cca8eb6776a117bcecd997";
hash = "sha256-R66i9MITdE9JlhD4wV0EitKPxyahQqDNpunUxVTmupA=";
};
sing-box-extra = fetchSource {
name = "sing-box-extra";
rev = "d31d6da26a51a929349e0d75fd89dccbe20d1268";
hash = "sha256-YlzMAff8VOZGyCP7ksjcmoBDHT5llTYwwXIrs+qO5P4=";
libneko = fetchSource {
name = "libneko";
rev = "1c47a3af71990a7b2192e03292b4d246c308ef0b";
hash = "sha256-9ftRh8K4z7m265dbEwWSBeNiwznnNl/FolVv4rZ4C8E=";
};

# revs found in https://github.com/MatsuriDayo/sing-box-extra/blob/<sing-box-extra.rev>/libs/get_source_env.sh
sing-box = fetchSource {
name = "sing-box";
rev = "64f4eed2c667d9ff1e52a84233dee0e2ca32c17e";
hash = "sha256-jIg/+fvTn46h6tE6YXtov+ZaBD/ywApTZbzHlT5v4lM=";
rev = "06557f6cef23160668122a17a818b378b5a216b5";
hash = "sha256-WyDYOY9udumTlf9ZNOYWKsPmJz3W/wp5kZYJkmvqokk=";
};
sing-quic = fetchSource {
name = "sing-quic";
rev = "e396733db4de15266f0cfdb43c392aca0759324a";
hash = "sha256-un5NtZPRx1QAjwNhXkR9OVGldtfM1jQoNRUzt9oilUE=";
};
libneko = fetchSource {
name = "libneko";
rev = "5277a5bfc889ee7a89462695b0e678c1bd4909b1";
hash = "sha256-6dlWDzI9ox4PQzEtJNgwA0pXmPC7fGrGId88Zl+1gpw=";
rev = "b49ce60d9b3622d5238fee96bfd3c5f6e3915b42";
hash = "sha256-U6v7ts2b9Kzp+U/hOR7b8JM42diOW2PV6lA9EDFoZRo=";
};
};

Expand All @@ -69,28 +60,30 @@ let

installGeodata = lib.concatStringsSep "\n" (
lib.mapAttrsToList (filename: file: ''
install -Dm644 ${file} "$out/share/nekoray/${filename}"
install -Dm644 ${file} "$out/share/nekobox/${filename}"
'') geodata
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "nekoray";
version = "3.26";
version = "4.0.1";

src = fetchSource {
name = "nekoray";
rev = finalAttrs.version;
hash = "sha256-fDm6fCI6XA4DHKCN3zm9B7Qbdh3LTHYGK8fPmeEnhjI=";
hash = "sha256-AaL/mROOciU42A6VDhsi6o0wUIReu0OWibEjKveHym8=";
fetchSubmodules = true;
};

patches = [ ./use-appdata.patch ];

strictDeps = true;

nativeBuildInputs = [
libsForQt5.wrapQtAppsHook
cmake
ninja
copyDesktopItems
libsForQt5.wrapQtAppsHook
ninja
];

buildInputs = [
Expand All @@ -103,40 +96,32 @@ stdenv.mkDerivation (finalAttrs: {
zxing-cpp
];

# NKR_PACKAGE makes sure the app uses the user's config directory to store it's non-static content
# it's essentially the same as always setting the -appdata flag when running the program
cmakeFlags = [ (lib.cmakeBool "NKR_PACKAGE" true) ];

installPhase = ''
runHook preInstall

install -Dm755 nekoray "$out/share/nekoray/nekoray"
install -Dm755 nekobox "$out/share/nekobox/nekobox"
mkdir -p "$out/bin"
ln -s "$out/share/nekoray/nekoray" "$out/bin"
ln -s "$out/share/nekobox/nekobox" "$out/bin"

# nekoray looks for other files and cores in the same directory it's located at
ln -s ${finalAttrs.passthru.nekoray-core}/bin/nekoray_core "$out/share/nekoray/nekoray_core"
ln -s ${finalAttrs.passthru.nekobox-core}/bin/nekobox_core "$out/share/nekoray/nekobox_core"
ln -s ${finalAttrs.passthru.nekobox-core}/bin/nekobox_core "$out/share/nekobox/nekobox_core"

${installGeodata}

install -Dm644 "$src/res/public/nekoray.png" "$out/share/icons/hicolor/256x256/apps/nekoray.png"
install -Dm644 "$src/res/public/nekobox.png" "$out/share/icons/hicolor/256x256/apps/nekobox.png"

runHook postInstall
'';

desktopItems = [
(makeDesktopItem {
name = "nekoray";
desktopName = "nekoray";
exec = "nekoray";
icon = "nekoray";
desktopName = "NekoRay";
exec = "nekobox";
icon = "nekobox";
comment = finalAttrs.meta.description;
terminal = false;
categories = [
"Network"
"Application"
];
categories = [ "Network" ];
})
];

Expand All @@ -145,17 +130,13 @@ stdenv.mkDerivation (finalAttrs: {
inherit (finalAttrs) src version;
inherit extraSources;
};
nekoray-core = callPackage ./nekoray-core.nix {
inherit (finalAttrs) src version;
inherit extraSources;
};
};

meta = {
description = "Qt based cross-platform GUI proxy configuration manager";
homepage = "https://github.com/MatsuriDayo/nekoray";
license = lib.licenses.gpl3Plus;
mainProgram = "nekoray";
mainProgram = "nekobox";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.linux;
};
Expand Down
27 changes: 27 additions & 0 deletions pkgs/by-name/ne/nekoray/use-appdata.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 4982b3ffa18ef7bfa5ef14f7bfa67b0c4bfe56f7 Mon Sep 17 00:00:00 2001
From: Pavel Sobolev <[email protected]>
Date: Thu, 26 Dec 2024 19:47:37 +0300
Subject: [PATCH] Use AppData.

See https://github.com/MatsuriDayo/nekoray/issues/1416.
---
main/main.cpp | 2 --
1 file changed, 2 deletions(-)

diff --git a/main/main.cpp b/main/main.cpp
index b14f04f..30ba0a7 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -91,9 +91,7 @@ int main(int argc, char* argv[]) {
if (NekoGui::dataStore->argv.contains("-debug")) NekoGui::dataStore->flag_debug = true;
if (NekoGui::dataStore->argv.contains("-flag_restart_tun_on")) NekoGui::dataStore->flag_restart_tun_on = true;
if (NekoGui::dataStore->argv.contains("-flag_reorder")) NekoGui::dataStore->flag_reorder = true;
-#ifdef NKR_CPP_USE_APPDATA
NekoGui::dataStore->flag_use_appdata = true; // Example: Package & MacOS
-#endif
#ifdef NKR_CPP_DEBUG
NekoGui::dataStore->flag_debug = true;
#endif
--
2.47.0

Loading