depot/third_party/nixpkgs/pkgs/tools/networking/xray/default.nix
Default email 555cd8a8f9 Project import generated by Copybara.
GitOrigin-RevId: 5633bcff0c6162b9e4b5f1264264611e950c8ec7
2024-10-09 18:51:18 +02:00

60 lines
1.4 KiB
Nix

{ 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";
version = "24.9.30";
src = fetchFromGitHub {
owner = "XTLS";
repo = "Xray-core";
rev = "v${version}";
hash = "sha256-36Uo1ROM4x2LW5RsYvAhIE6TmbcYAbLspoxv/yOXDew=";
};
vendorHash = "sha256-6zcYyxWgvJPE7JG2/t4pGJ+2fJfEntnU7QKjICyLGkU=";
nativeBuildInputs = [ makeWrapper ];
doCheck = false;
ldflags = [ "-s" "-w" ];
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 \
--set-default V2RAY_LOCATION_ASSET $assetsDrv/share/v2ray \
--set-default XRAY_LOCATION_ASSET $assetsDrv/share/v2ray
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Platform for building proxies to bypass network restrictions. A replacement for v2ray-core, with XTLS support and fully compatible configuration";
mainProgram = "xray";
homepage = "https://github.com/XTLS/Xray-core";
license = with lib.licenses; [ mpl20 ];
maintainers = with lib.maintainers; [ iopq ];
};
}