2022-11-02 22:02:43 +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-02-07 01:22:34 +00:00
|
|
|
version = "1.8.7";
|
2022-11-02 22:02:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "XTLS";
|
|
|
|
repo = "Xray-core";
|
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-yS2DsM9RVAHStoqWVns9GkoYuFS69v7S3uTbRaV9Aog=";
|
2022-11-02 22:02:43 +00:00
|
|
|
};
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
vendorHash = "sha256-HRUUZjc0TcZ/fXTneG/h/m3QyesHL+/Nu1pFqZ3LUDI=";
|
2022-11-02 22:02:43 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
ldflags = [ "-s" "-w" ];
|
2022-11-02 22:02:43 +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 \
|
2023-04-29 16:46:19 +00:00
|
|
|
--suffix V2RAY_LOCATION_ASSET : $assetsDrv/share/v2ray \
|
|
|
|
--suffix XRAY_LOCATION_ASSET : $assetsDrv/share/v2ray
|
2022-11-02 22:02:43 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2022-12-28 21:21:41 +00:00
|
|
|
updateScript = nix-update-script { };
|
2022-11-02 22:02:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A platform for building proxies to bypass network restrictions. A replacement for v2ray-core, with XTLS support and fully compatible configuration";
|
|
|
|
homepage = "https://github.com/XTLS/Xray-core";
|
|
|
|
license = with lib.licenses; [ mpl20 ];
|
|
|
|
maintainers = with lib.maintainers; [ iopq ];
|
|
|
|
};
|
|
|
|
}
|