diff options
author | Robert Scott <code@humanleg.org.uk> | 2020-09-07 21:29:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-07 21:29:51 +0100 |
commit | 61525137fd1002f6f2a5eb0ea27d480713362cd5 (patch) | |
tree | d1c250ead6121eb9e5b83e06e960a1eaa9404330 /pkgs | |
parent | b44c531f72c5f289ac2ca29a24913e8ff881dcd1 (diff) | |
parent | 312e17b3299612834db46ef988a0fe0722a57516 (diff) |
Merge pull request #96958 from servalcatty/v2ray
v2ray: 4.26.0 -> 4.27.5 and add tests
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/tools/networking/v2ray/default.nix | 73 | ||||
-rw-r--r-- | pkgs/tools/networking/v2ray/generic.nix | 52 |
2 files changed, 62 insertions, 63 deletions
diff --git a/pkgs/tools/networking/v2ray/default.nix b/pkgs/tools/networking/v2ray/default.nix index ab3f5eb3ef4d9..bc8a0873f7845 100644 --- a/pkgs/tools/networking/v2ray/default.nix +++ b/pkgs/tools/networking/v2ray/default.nix @@ -1,24 +1,24 @@ -{ callPackage, fetchFromGitHub, fetchurl +{ lib, fetchFromGitHub, fetchurl, linkFarm, buildGoModule, runCommand, makeWrapper, nixosTests , assetOverrides ? {} -, ... } @ args: +}: -callPackage ./generic.nix (rec { - version = "4.26.0"; +let + version = "4.27.5"; src = fetchFromGitHub { owner = "v2ray"; repo = "v2ray-core"; rev = "v${version}"; - sha256 = "069wm0n44i4l9pnrhwf60ssld65p6gfj4wfc68hrhj4zi4jvlyds"; + sha256 = "168kz8hq7mcfy6h758mmrky550p04bi9jsfqhy67jcxq81874m2k"; }; - vendorSha256 = "1520h69z0inbsrw5505cxbinqakvwcrdx3pisrwnp9lv4jsrzzsr"; + vendorSha256 = "0m889byxw70vv1mzlivalq444byp0y182nqqzdr458gfifvpc7s7"; assets = { # MIT licensed "geoip.dat" = let - geoipRev = "202007080004"; - geoipSha256 = "1j4qg831dhxdy7brgxn4ca69cvwr3zsgizidlzasbkdn2rwai17y"; + geoipRev = "202009020005"; + geoipSha256 = "1xsy678cpqv6ycnhzl3pms76ic40aggq46q9dsd5ghj94mcx9837"; in fetchurl { url = "https://github.com/v2ray/geoip/releases/download/${geoipRev}/geoip.dat"; sha256 = geoipSha256; @@ -26,8 +26,8 @@ callPackage ./generic.nix (rec { # MIT licensed "geosite.dat" = let - geositeRev = "20200708125309"; - geositeSha256 = "1pr4137ri3v3r880yx5sqf2p7qfn8g7s555q51x3smkjzkyrskcy"; + geositeRev = "20200901194123"; + geositeSha256 = "0fjx1wrq14d9v326k4fjwca3h5nv8ghk11kprf6jkjncjszwvgby"; in fetchurl { url = "https://github.com/v2ray/domain-list-community/releases/download/${geositeRev}/dlc.dat"; sha256 = geositeSha256; @@ -35,4 +35,55 @@ callPackage ./generic.nix (rec { } // assetOverrides; -} // args) + assetsDrv = linkFarm "v2ray-assets" (lib.mapAttrsToList (name: path: { + inherit name path; + }) assets); + + core = buildGoModule rec { + pname = "v2ray-core"; + inherit version src; + + inherit vendorSha256; + + doCheck = false; + + buildPhase = '' + runHook preBuild + + go build -o v2ray v2ray.com/core/main + go build -o v2ctl v2ray.com/core/infra/control/main + + runHook postBuild + ''; + + installPhase = '' + install -Dm755 v2ray v2ctl -t $out/bin + ''; + }; + +in runCommand "v2ray-${version}" { + inherit version; + + buildInputs = [ assetsDrv core ]; + nativeBuildInputs = [ makeWrapper ]; + + meta = { + homepage = "https://www.v2ray.com/en/index.html"; + description = "A platform for building proxies to bypass network restrictions"; + license = with lib.licenses; [ mit ]; + maintainers = with lib.maintainers; [ servalcatty ]; + }; + + passthru = { + updateScript = ./update.sh; + tests = { + simple-vmess-proxy-test = nixosTests.v2ray; + }; + }; + +} '' + for file in ${core}/bin/*; do + makeWrapper "$file" "$out/bin/$(basename "$file")" \ + --set-default V2RAY_LOCATION_ASSET ${assetsDrv} + done +'' diff --git a/pkgs/tools/networking/v2ray/generic.nix b/pkgs/tools/networking/v2ray/generic.nix deleted file mode 100644 index 4499e91425f98..0000000000000 --- a/pkgs/tools/networking/v2ray/generic.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ lib, linkFarm, buildGoModule, runCommand, makeWrapper - -# Version specific args -, version, src, assets, vendorSha256 -, ... }: - -let - assetsDrv = linkFarm "v2ray-assets" (lib.mapAttrsToList (name: path: { - inherit name path; - }) assets); - - core = buildGoModule rec { - pname = "v2ray-core"; - inherit version src; - - inherit vendorSha256; - - doCheck = false; - - buildPhase = '' - runHook preBuild - - go build -o v2ray v2ray.com/core/main - go build -o v2ctl v2ray.com/core/infra/control/main - - runHook postBuild - ''; - - installPhase = '' - install -Dm755 v2ray v2ctl -t $out/bin - ''; - }; - -in runCommand "v2ray-${version}" { - inherit version; - - buildInputs = [ assetsDrv core ]; - nativeBuildInputs = [ makeWrapper ]; - - meta = { - homepage = "https://www.v2ray.com/en/index.html"; - description = "A platform for building proxies to bypass network restrictions"; - license = with lib.licenses; [ mit ]; - maintainers = with lib.maintainers; [ servalcatty ]; - }; - -} '' - for file in ${core}/bin/*; do - makeWrapper "$file" "$out/bin/$(basename "$file")" \ - --set-default V2RAY_LOCATION_ASSET ${assetsDrv} - done -'' |