depot/third_party/nixpkgs/pkgs/tools/networking/xray/default.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +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 = "1.8.11";
src = fetchFromGitHub {
owner = "XTLS";
repo = "Xray-core";
rev = "v${version}";
hash = "sha256-uOE+Gp42WsqSA5/kQRjk+BKq9igmZCrq/9v1BJMXwFc=";
};
vendorHash = "sha256-7E/H8ctv9BU59wPmywNeDhx1R4mqrjpM9E+Hz+AaPlk=";
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 \
--suffix V2RAY_LOCATION_ASSET : $assetsDrv/share/v2ray \
--suffix XRAY_LOCATION_ASSET : $assetsDrv/share/v2ray
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "A 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 ];
};
}