mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 00:33:10 +00:00
bfb7a581c8
While the package itself will look for assets in both folders, ./xray and ./v2ray the GUIs don't always support this, so since we use the v2ray-assets we should also set the V2RAY_LOCATION_ASSET variable to hint them to look at the ./v2ray folder
68 lines
1.4 KiB
Nix
68 lines
1.4 KiB
Nix
{ 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";
|
|
version = "1.8.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "XTLS";
|
|
repo = "Xray-core";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-YonO856ax0RTkM3SwgsS/1HxijkaV5XUXvWYDL3NyvM=";
|
|
};
|
|
|
|
vendorSha256 = "sha256-lWeYuyzW8bR51LrFguOxOyNzihMuFF6MkFeGuNv8Vyc=";
|
|
|
|
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 V2RAY_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";
|
|
homepage = "https://github.com/XTLS/Xray-core";
|
|
license = with lib.licenses; [ mpl20 ];
|
|
maintainers = with lib.maintainers; [ iopq ];
|
|
};
|
|
}
|