nekoray: init at 3.26 (#300794)

* nekoray: init at 3.26

* nekoray: limit meta.platforms to linux

---------

Co-authored-by: Aleksana <alexander.huang.y@gmail.com>

authored by Toma Aleksana and committed by GitHub b95f829e d2fc79db

+221
+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 + }
+159
pkgs/by-name/ne/nekoray/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + libsForQt5, 6 + cmake, 7 + ninja, 8 + protobuf, 9 + yaml-cpp, 10 + zxing-cpp, 11 + callPackage, 12 + makeDesktopItem, 13 + copyDesktopItems, 14 + 15 + v2ray-geoip, 16 + v2ray-domain-list-community, 17 + sing-geoip, 18 + sing-geosite, 19 + }: 20 + 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 + stdenv.mkDerivation (finalAttrs: { 77 + pname = "nekoray"; 78 + version = "3.26"; 79 + 80 + src = fetchSource { 81 + name = "nekoray"; 82 + rev = finalAttrs.version; 83 + hash = "sha256-fDm6fCI6XA4DHKCN3zm9B7Qbdh3LTHYGK8fPmeEnhjI="; 84 + fetchSubmodules = true; 85 + }; 86 + 87 + nativeBuildInputs = [ 88 + libsForQt5.wrapQtAppsHook 89 + cmake 90 + ninja 91 + protobuf 92 + copyDesktopItems 93 + ]; 94 + 95 + buildInputs = [ 96 + libsForQt5.qtbase 97 + libsForQt5.qttools 98 + libsForQt5.qtx11extras 99 + zxing-cpp 100 + yaml-cpp 101 + ]; 102 + 103 + # NKR_PACKAGE makes sure the app uses the user's config directory to store it's non-static content 104 + # it's essentially the same as always setting the -appdata flag when running the program 105 + cmakeFlags = [ (lib.cmakeBool "NKR_PACKAGE" true) ]; 106 + 107 + installPhase = '' 108 + runHook preInstall 109 + 110 + install -Dm755 nekoray "$out/share/nekoray/nekoray" 111 + mkdir -p "$out/bin" 112 + ln -s "$out/share/nekoray/nekoray" "$out/bin" 113 + 114 + # nekoray looks for other files and cores in the same directory it's located at 115 + ln -s ${finalAttrs.passthru.nekoray-core}/bin/nekoray_core "$out/share/nekoray/nekoray_core" 116 + ln -s ${finalAttrs.passthru.nekobox-core}/bin/nekobox_core "$out/share/nekoray/nekobox_core" 117 + 118 + ${installGeodata} 119 + 120 + install -Dm644 "$src/res/public/nekoray.png" "$out/share/icons/hicolor/256x256/apps/nekoray.png" 121 + 122 + runHook postInstall 123 + ''; 124 + 125 + desktopItems = [ 126 + (makeDesktopItem { 127 + name = "nekoray"; 128 + desktopName = "nekoray"; 129 + exec = "nekoray"; 130 + icon = "nekoray"; 131 + comment = finalAttrs.meta.description; 132 + terminal = false; 133 + categories = [ 134 + "Network" 135 + "Application" 136 + ]; 137 + }) 138 + ]; 139 + 140 + passthru = { 141 + nekobox-core = callPackage ./nekobox-core.nix { 142 + inherit (finalAttrs) src version; 143 + inherit extraSources; 144 + }; 145 + nekoray-core = callPackage ./nekoray-core.nix { 146 + inherit (finalAttrs) src version; 147 + inherit extraSources; 148 + }; 149 + }; 150 + 151 + meta = { 152 + description = "Qt based cross-platform GUI proxy configuration manager"; 153 + homepage = "https://github.com/MatsuriDayo/nekoray"; 154 + license = lib.licenses.gpl3Plus; 155 + mainProgram = "nekoray"; 156 + maintainers = with lib.maintainers; [ tomasajt ]; 157 + platforms = lib.platforms.linux; 158 + }; 159 + })