2022-11-02 22:02:43 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, symlinkJoin
|
|
|
|
, buildGoModule
|
|
|
|
, runCommand
|
|
|
|
, makeWrapper
|
|
|
|
, nix-update-script
|
|
|
|
, v2ray-geoip
|
|
|
|
, v2ray-domain-list-community
|
|
|
|
, assets ? [ v2ray-geoip v2ray-domain-list-community ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
assetsDrv = symlinkJoin {
|
|
|
|
name = "v2ray-assets";
|
|
|
|
paths = assets;
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "xray";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "1.7.2";
|
2022-11-02 22:02:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "XTLS";
|
|
|
|
repo = "Xray-core";
|
|
|
|
rev = "v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-jwCvo6+YXC471VqGWzcrnrLWOSJW2tBKa5SoynQg0Lo=";
|
2022-11-02 22:02:43 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
vendorSha256 = "sha256-P2g0MqlBScm6yTnpvL5T6l9ntsb4tK9k3Civ7rTevrE=";
|
2022-11-02 22:02:43 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" "-buildid=" ];
|
|
|
|
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 XRAY_LOCATION_ASSET : $assetsDrv/share/v2ray
|
|
|
|
'';
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|