···1{2 lib,3 stdenv,4+5+ buildGoModule,6 fetchFromGitHub,7+ makeDesktopItem,8+9 cmake,10+ copyDesktopItems,11 ninja,12+13+ libcpr,14 protobuf,15+ qt6Packages,16 yaml-cpp,17 zxing-cpp,000180019 sing-geoip,20 sing-geosite,21}:22000000000000000000000000000000000000000000000000000000023stdenv.mkDerivation (finalAttrs: {24 pname = "nekoray";25+ version = "4.2.12";2627+ src = fetchFromGitHub {28+ owner = "Mahdi-zarei";29+ repo = "nekoray";30+ tag = finalAttrs.version;31+ hash = "sha256-5BXrfNPBZ+smpniA1jOPWE0X/be/C9MzswfbwmWEnyQ=";32 };3334 strictDeps = true;3536 nativeBuildInputs = [037 cmake038 copyDesktopItems39+ ninja40+ qt6Packages.wrapQtAppsHook41 ];4243 buildInputs = [44+ libcpr00045 protobuf46+ qt6Packages.qtbase47+ qt6Packages.qttools48 yaml-cpp49 zxing-cpp50 ];5152+ cmakeFlags = [53+ # makes sure the app uses the user's config directory to store it's non-static content54+ # it's essentially the same as always setting the -appdata flag when running the program55+ (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/nekoray60+ # we already package those two files in nixpkgs61+ # we can't place file at that location using our builder so we must change the search directory to be relative to the built executable62+ ./search-for-geodata-in-install-location.patch63+ ];6465 installPhase = ''66 runHook preInstall···115 ln -s "$out/share/nekoray/nekoray" "$out/bin"116117 # nekoray looks for other files and cores in the same directory it's located at0118 ln -s ${finalAttrs.passthru.nekobox-core}/bin/nekobox_core "$out/share/nekoray/nekobox_core"119120+ # our patch also makes nekoray look for geodata files next to the executable121+ ln -s ${sing-geoip}/share/sing-box/geoip.db "$out/share/nekoray/geoip.db"122+ ln -s ${sing-geosite}/share/sing-box/geosite.db "$out/share/nekoray/geosite.db"123124 runHook postInstall125 '';···133 icon = "nekoray";134 comment = finalAttrs.meta.description;135 terminal = false;136+ categories = [ "Network" ];000137 })138 ];139140+ passthru.nekobox-core = buildGoModule {141+ pname = "nekobox-core";142+ inherit (finalAttrs) version src;143+ sourceRoot = "${finalAttrs.src.name}/core/server";144+145+ vendorHash = "sha256-PDED6Haa3m2CZLij2A8Am7vSwep2YFrR984UNypduWo=";146+147+ # ldflags and tags are taken from script/build_go.sh148+ ldflags = [149+ "-w"150+ "-s"151+ "-X github.com/sagernet/sing-box/constant.Version=${finalAttrs.version}"152+ ];153+154+ tags = [155+ "with_clash_api"156+ "with_gvisor"157+ "with_quic"158+ "with_wireguard"159+ "with_utls"160+ "with_ech"161+ "with_dhcp"162+ ];163 };164165 meta = {166 description = "Qt based cross-platform GUI proxy configuration manager";167+ homepage = "https://github.com/Mahdi-zarei/nekoray";168 license = lib.licenses.gpl3Plus;169 mainProgram = "nekoray";170 maintainers = with lib.maintainers; [ tomasajt ];