# Xray-core ahead of nixpkgs, which still ships 26.3.27. From 26.9.8 its go.mod # asks for Go 1.27, so the builder is swapped along with the source. Steps # aside once nixpkgs has caught up; the patch stays. # # The patch marks an outbound's sockets by the level of the inbound user they dial for # (inbounds.manager's speed limits); passthru.userLevelMark says it is in. { pkgs }: let inherit (pkgs) lib; version = "26.10.21"; base = if lib.versionAtLeast pkgs.xray.version version then pkgs.xray else (pkgs.xray.override ( args: lib.optionalAttrs (args ? buildGo126Module) { buildGo126Module = pkgs.buildGo127Module; } )).overrideAttrs ( finalAttrs: _: { inherit version; src = pkgs.fetchFromGitHub { owner = "XTLS"; repo = "Xray-core"; rev = "v${finalAttrs.version}"; hash = "sha256-1FwcB/qZaH7W9b+GSe+CG/s+uStaDjz792OxDc3uAyg="; }; vendorHash = "sha256-o4mKfCGgI4r5ZatnA4AsK4zR0/qOl2qpqCmoJmE2jBQ="; } ); in base.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ ./patches/xray-user-level-mark.patch ]; passthru = (old.passthru or { }) // { userLevelMark = true; }; })