2022-08-23 07:43:16 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, symlinkJoin
|
|
|
|
, buildGoModule
|
|
|
|
, makeWrapper
|
|
|
|
, nix-update-script
|
|
|
|
, v2ray-geoip
|
|
|
|
, v2ray-domain-list-community
|
|
|
|
, assets ? [ v2ray-geoip v2ray-domain-list-community ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "xray";
|
2024-05-24 09:15:40 +00:00
|
|
|
version = "1.8.13";
|
2022-08-23 07:43:16 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "XTLS";
|
|
|
|
repo = "Xray-core";
|
|
|
|
rev = "v${version}";
|
2024-05-24 09:15:40 +00:00
|
|
|
hash = "sha256-+npmj8Cz3/XTabAXL+J02EmyvPwtwz9TKazd9z9emwI=";
|
2022-08-23 07:43:16 +00:00
|
|
|
};
|
|
|
|
|
2024-05-24 09:15:40 +00:00
|
|
|
vendorHash = "sha256-55mNCD3p6Xy6S1w8WzJwxKttjEkEjJZcGTLQdWl1bQQ=";
|
2022-08-23 07:43:16 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2023-12-24 20:14:12 +00:00
|
|
|
ldflags = [ "-s" "-w" ];
|
2022-08-23 07:43:16 +00:00
|
|
|
subPackages = [ "main" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
install -Dm555 "$GOPATH"/bin/main $out/bin/xray
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
assetsDrv = symlinkJoin {
|
|
|
|
name = "v2ray-assets";
|
|
|
|
paths = assets;
|
|
|
|
};
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/xray \
|
2024-05-21 14:11:59 +00:00
|
|
|
--set-default V2RAY_LOCATION_ASSET $assetsDrv/share/v2ray \
|
|
|
|
--set-default XRAY_LOCATION_ASSET $assetsDrv/share/v2ray
|
2022-08-23 07:43:16 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2022-12-25 22:11:14 +00:00
|
|
|
updateScript = nix-update-script { };
|
2022-08-23 07:43:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2024-06-07 07:46:46 +00:00
|
|
|
description = "Platform for building proxies to bypass network restrictions. A replacement for v2ray-core, with XTLS support and fully compatible configuration";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "xray";
|
2022-08-23 07:43:16 +00:00
|
|
|
homepage = "https://github.com/XTLS/Xray-core";
|
|
|
|
license = with lib.licenses; [ mpl20 ];
|
|
|
|
maintainers = with lib.maintainers; [ iopq ];
|
|
|
|
};
|
|
|
|
}
|