about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-10-30 19:51:28 +0100
committerGitHub <noreply@github.com>2022-10-30 19:51:28 +0100
commit4d4fdde2cfcdbf0b94447d993ff50f537dcc2aa3 (patch)
treeef17dbe739cb430c6286a3dadece49f9d352cf2a /pkgs/tools
parent88045f89c3ddbeee615a1d6b162aaf8e0ae6de84 (diff)
parent96f7444bc8ede288c34d7a3ff4f740054f6c4154 (diff)
Merge pull request #197876 from iopq/alt-history
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/networking/xray/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/tools/networking/xray/default.nix b/pkgs/tools/networking/xray/default.nix
new file mode 100644
index 0000000000000..be95d26fa34f9
--- /dev/null
+++ b/pkgs/tools/networking/xray/default.nix
@@ -0,0 +1,69 @@
+{ 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.6.1";
+
+  src = fetchFromGitHub {
+    owner = "XTLS";
+    repo = "Xray-core";
+    rev = "v${version}";
+    sha256 = "0g2bmy522lhip0rgb3hqyi3bidf4ljyjvvv3n1kb6lvm0p3br51b";
+  };
+
+  vendorSha256 = "sha256-QAF/05/5toP31a/l7mTIetFhXuAKsT69OI1K/gMXei0=";
+
+  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 = {
+    updateScript = nix-update-script {
+      attrPath = pname;
+    };
+  };
+
+  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 ];
+  };
+}