Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

nekoray: switch to maintained fork, 3.26 -> 4.2.12

authored by

TomaSajt and committed by
Masum Reza
f7c9d689 dab7ae6c

+72 -156
-36
pkgs/by-name/ne/nekoray/nekobox-core.nix
··· 1 - { 2 - buildGoModule, 3 - version, 4 - src, 5 - extraSources, 6 - }: 7 - 8 - buildGoModule rec { 9 - pname = "nekobox-core"; 10 - inherit version src; 11 - sourceRoot = "${src.name}/go/cmd/nekobox_core"; 12 - 13 - postPatch = '' 14 - cp -r --no-preserve=all ${extraSources.libneko} ../../../../libneko 15 - cp -r --no-preserve=all ${extraSources.sing-box-extra} ../../../../sing-box-extra 16 - cp -r --no-preserve=all ${extraSources.sing-box} ../../../../sing-box 17 - cp -r --no-preserve=all ${extraSources.sing-quic} ../../../../sing-quic 18 - ''; 19 - 20 - vendorHash = "sha256-q/Co67AwJVElJnEY2O0SLLUzwlGiqazKu+fD/nnbrTk="; 21 - 22 - ldflags = [ 23 - "-w" 24 - "-s" 25 - "-X github.com/matsuridayo/libneko/neko_common.Version_neko=${version}" 26 - ]; 27 - 28 - tags = [ 29 - "with_clash_api" 30 - "with_gvisor" 31 - "with_quic" 32 - "with_wireguard" 33 - "with_utls" 34 - "with_ech" 35 - ]; 36 - }
-26
pkgs/by-name/ne/nekoray/nekoray-core.nix
··· 1 - { 2 - buildGoModule, 3 - version, 4 - src, 5 - extraSources, 6 - }: 7 - 8 - buildGoModule rec { 9 - pname = "nekoray-core"; 10 - inherit version src; 11 - sourceRoot = "${src.name}/go/cmd/nekoray_core"; 12 - 13 - postPatch = '' 14 - cp -r --no-preserve=all ${extraSources.libneko} ../../../../libneko 15 - cp -r --no-preserve=all ${extraSources.Xray-core} ../../../../Xray-core 16 - ''; 17 - 18 - vendorHash = "sha256-gxp5oI7qO+bdSe8Yrb9I4Wkl5TqqZeIhzcQDg1OpRkc="; 19 - 20 - ldflags = [ 21 - "-w" 22 - "-s" 23 - "-X github.com/matsuridayo/libneko/neko_common.Version_neko=${version}" 24 - "-X github.com/matsuridayo/libneko/neko_common.Version_v2ray=${extraSources.Xray-core.rev}" 25 - ]; 26 - }
+59 -94
pkgs/by-name/ne/nekoray/package.nix
··· 1 1 { 2 2 lib, 3 3 stdenv, 4 + 5 + buildGoModule, 4 6 fetchFromGitHub, 5 - libsForQt5, 7 + makeDesktopItem, 8 + 6 9 cmake, 10 + copyDesktopItems, 7 11 ninja, 12 + 13 + libcpr, 8 14 protobuf, 15 + qt6Packages, 9 16 yaml-cpp, 10 17 zxing-cpp, 11 - callPackage, 12 - makeDesktopItem, 13 - copyDesktopItems, 14 18 15 - v2ray-geoip, 16 - v2ray-domain-list-community, 17 19 sing-geoip, 18 20 sing-geosite, 19 21 }: 20 22 21 - let 22 - fetchSource = 23 - args: 24 - fetchFromGitHub ( 25 - args 26 - // { 27 - owner = "MatsuriDayo"; 28 - repo = args.name; 29 - } 30 - ); 31 - 32 - extraSources = { 33 - # revs found in https://github.com/MatsuriDayo/nekoray/blob/<version>/libs/get_source_env.sh 34 - Xray-core = fetchSource { 35 - name = "Xray-core"; 36 - rev = "01208225ee7e508044cca8eb6776a117bcecd997"; 37 - hash = "sha256-R66i9MITdE9JlhD4wV0EitKPxyahQqDNpunUxVTmupA="; 38 - }; 39 - sing-box-extra = fetchSource { 40 - name = "sing-box-extra"; 41 - rev = "d31d6da26a51a929349e0d75fd89dccbe20d1268"; 42 - hash = "sha256-YlzMAff8VOZGyCP7ksjcmoBDHT5llTYwwXIrs+qO5P4="; 43 - }; 44 - 45 - # revs found in https://github.com/MatsuriDayo/sing-box-extra/blob/<sing-box-extra.rev>/libs/get_source_env.sh 46 - sing-box = fetchSource { 47 - name = "sing-box"; 48 - rev = "64f4eed2c667d9ff1e52a84233dee0e2ca32c17e"; 49 - hash = "sha256-jIg/+fvTn46h6tE6YXtov+ZaBD/ywApTZbzHlT5v4lM="; 50 - }; 51 - sing-quic = fetchSource { 52 - name = "sing-quic"; 53 - rev = "e396733db4de15266f0cfdb43c392aca0759324a"; 54 - hash = "sha256-un5NtZPRx1QAjwNhXkR9OVGldtfM1jQoNRUzt9oilUE="; 55 - }; 56 - libneko = fetchSource { 57 - name = "libneko"; 58 - rev = "5277a5bfc889ee7a89462695b0e678c1bd4909b1"; 59 - hash = "sha256-6dlWDzI9ox4PQzEtJNgwA0pXmPC7fGrGId88Zl+1gpw="; 60 - }; 61 - }; 62 - 63 - geodata = { 64 - "geoip.dat" = "${v2ray-geoip}/share/v2ray/geoip.dat"; 65 - "geosite.dat" = "${v2ray-domain-list-community}/share/v2ray/geosite.dat"; 66 - "geoip.db" = "${sing-geoip}/share/sing-box/geoip.db"; 67 - "geosite.db" = "${sing-geosite}/share/sing-box/geosite.db"; 68 - }; 69 - 70 - installGeodata = lib.concatStringsSep "\n" ( 71 - lib.mapAttrsToList (filename: file: '' 72 - install -Dm644 ${file} "$out/share/nekoray/${filename}" 73 - '') geodata 74 - ); 75 - in 76 23 stdenv.mkDerivation (finalAttrs: { 77 24 pname = "nekoray"; 78 - version = "3.26"; 25 + version = "4.2.12"; 79 26 80 - src = fetchSource { 81 - name = "nekoray"; 82 - rev = finalAttrs.version; 83 - hash = "sha256-fDm6fCI6XA4DHKCN3zm9B7Qbdh3LTHYGK8fPmeEnhjI="; 84 - fetchSubmodules = true; 27 + src = fetchFromGitHub { 28 + owner = "Mahdi-zarei"; 29 + repo = "nekoray"; 30 + tag = finalAttrs.version; 31 + hash = "sha256-5BXrfNPBZ+smpniA1jOPWE0X/be/C9MzswfbwmWEnyQ="; 85 32 }; 86 33 87 34 strictDeps = true; 88 35 89 36 nativeBuildInputs = [ 90 - libsForQt5.wrapQtAppsHook 91 37 cmake 38 + copyDesktopItems 92 39 ninja 93 - copyDesktopItems 40 + qt6Packages.wrapQtAppsHook 94 41 ]; 95 42 96 43 buildInputs = [ 97 - libsForQt5.qtbase 98 - libsForQt5.qttools 99 - libsForQt5.qtwayland 100 - libsForQt5.qtx11extras 44 + libcpr 101 45 protobuf 46 + qt6Packages.qtbase 47 + qt6Packages.qttools 102 48 yaml-cpp 103 49 zxing-cpp 104 50 ]; 105 51 106 - # NKR_PACKAGE makes sure the app uses the user's config directory to store it's non-static content 107 - # it's essentially the same as always setting the -appdata flag when running the program 108 - cmakeFlags = [ (lib.cmakeBool "NKR_PACKAGE" true) ]; 52 + cmakeFlags = [ 53 + # makes sure the app uses the user's config directory to store it's non-static content 54 + # it's essentially the same as always setting the -appdata flag when running the program 55 + (lib.cmakeBool "NKR_PACKAGE" true) 56 + ]; 57 + 58 + patches = [ 59 + # if compiled with NKR_PACKAGE, nekoray assumes geoip.db and geosite.db will be found in ~/.config/nekoray 60 + # we already package those two files in nixpkgs 61 + # we can't place file at that location using our builder so we must change the search directory to be relative to the built executable 62 + ./search-for-geodata-in-install-location.patch 63 + ]; 109 64 110 65 installPhase = '' 111 66 runHook preInstall ··· 115 70 ln -s "$out/share/nekoray/nekoray" "$out/bin" 116 71 117 72 # nekoray looks for other files and cores in the same directory it's located at 118 - ln -s ${finalAttrs.passthru.nekoray-core}/bin/nekoray_core "$out/share/nekoray/nekoray_core" 119 73 ln -s ${finalAttrs.passthru.nekobox-core}/bin/nekobox_core "$out/share/nekoray/nekobox_core" 120 74 121 - ${installGeodata} 122 - 123 - install -Dm644 "$src/res/public/nekoray.png" "$out/share/icons/hicolor/256x256/apps/nekoray.png" 75 + # our patch also makes nekoray look for geodata files next to the executable 76 + ln -s ${sing-geoip}/share/sing-box/geoip.db "$out/share/nekoray/geoip.db" 77 + ln -s ${sing-geosite}/share/sing-box/geosite.db "$out/share/nekoray/geosite.db" 124 78 125 79 runHook postInstall 126 80 ''; ··· 133 87 icon = "nekoray"; 134 88 comment = finalAttrs.meta.description; 135 89 terminal = false; 136 - categories = [ 137 - "Network" 138 - "Application" 139 - ]; 90 + categories = [ "Network" ]; 140 91 }) 141 92 ]; 142 93 143 - passthru = { 144 - nekobox-core = callPackage ./nekobox-core.nix { 145 - inherit (finalAttrs) src version; 146 - inherit extraSources; 147 - }; 148 - nekoray-core = callPackage ./nekoray-core.nix { 149 - inherit (finalAttrs) src version; 150 - inherit extraSources; 151 - }; 94 + passthru.nekobox-core = buildGoModule { 95 + pname = "nekobox-core"; 96 + inherit (finalAttrs) version src; 97 + sourceRoot = "${finalAttrs.src.name}/core/server"; 98 + 99 + vendorHash = "sha256-PDED6Haa3m2CZLij2A8Am7vSwep2YFrR984UNypduWo="; 100 + 101 + # ldflags and tags are taken from script/build_go.sh 102 + ldflags = [ 103 + "-w" 104 + "-s" 105 + "-X github.com/sagernet/sing-box/constant.Version=${finalAttrs.version}" 106 + ]; 107 + 108 + tags = [ 109 + "with_clash_api" 110 + "with_gvisor" 111 + "with_quic" 112 + "with_wireguard" 113 + "with_utls" 114 + "with_ech" 115 + "with_dhcp" 116 + ]; 152 117 }; 153 118 154 119 meta = { 155 120 description = "Qt based cross-platform GUI proxy configuration manager"; 156 - homepage = "https://github.com/MatsuriDayo/nekoray"; 121 + homepage = "https://github.com/Mahdi-zarei/nekoray"; 157 122 license = lib.licenses.gpl3Plus; 158 123 mainProgram = "nekoray"; 159 124 maintainers = with lib.maintainers; [ tomasajt ];
+13
pkgs/by-name/ne/nekoray/search-for-geodata-in-install-location.patch
··· 1 + diff --git a/src/global/NekoGui.cpp b/src/global/NekoGui.cpp 2 + index d9be515..15de64b 100644 3 + --- a/src/global/NekoGui.cpp 4 + +++ b/src/global/NekoGui.cpp 5 + @@ -426,8 +426,6 @@ namespace NekoGui { 6 + }; 7 + 8 + QString GetBasePath() { 9 + - if (dataStore->flag_use_appdata) return QStandardPaths::writableLocation( 10 + - QStandardPaths::AppConfigLocation); 11 + return qApp->applicationDirPath(); 12 + } 13 +