ngrok: 3.10.1 -> 3.13.0 (#328897)

* ngrok: move to pkgs/by-name

* ngrok: support phase hooks

* ngrok: reuse lib.platforms.unix

* ngrok: format using nixfmt-rfc-style

* ngrok: add downloadPage and changelog

* ngrok: remove nested `with lib`

* ngrok: use xh instead of httpie for updateScript

Currently httpie cannot validate HTTPS certificate due to
https://github.com/NixOS/nixpkgs/issues/94666. xh is an alternative
where this problem does not exist.

* ngrok: 3.10.1 -> 3.13.0

* ngrok: format update.sh

* ngrok: use BASH_SOURCE in update.sh

* ngrok: strip on non-darwin systems

authored by bobvanderlinden.tngl.sh and committed by GitHub a298a03b d51dad7c

+149 -121
+77
pkgs/by-name/ng/ngrok/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchurl, 5 + }: 6 + 7 + let 8 + versions = lib.importJSON ./versions.json; 9 + arch = 10 + if stdenv.isi686 then 11 + "386" 12 + else if stdenv.isx86_64 then 13 + "amd64" 14 + else if stdenv.isAarch32 then 15 + "arm" 16 + else if stdenv.isAarch64 then 17 + "arm64" 18 + else 19 + throw "Unsupported architecture"; 20 + os = 21 + if stdenv.isLinux then 22 + "linux" 23 + else if stdenv.isDarwin then 24 + "darwin" 25 + else 26 + throw "Unsupported os"; 27 + versionInfo = versions."${os}-${arch}"; 28 + inherit (versionInfo) version sha256 url; 29 + 30 + in 31 + stdenv.mkDerivation { 32 + pname = "ngrok"; 33 + inherit version; 34 + 35 + # run ./update 36 + src = fetchurl { inherit sha256 url; }; 37 + 38 + sourceRoot = "."; 39 + 40 + unpackPhase = '' 41 + runHook preUnpack 42 + cp $src ngrok 43 + runHook postUnpack 44 + ''; 45 + 46 + buildPhase = '' 47 + runHook preBuild 48 + chmod a+x ngrok 49 + runHook postBuild 50 + ''; 51 + 52 + installPhase = '' 53 + runHook preInstall 54 + install -D ngrok $out/bin/ngrok 55 + runHook postInstall 56 + ''; 57 + 58 + passthru.updateScript = ./update.sh; 59 + 60 + # Stripping causes SEGFAULT on darwin 61 + dontStrip = stdenv.isDarwin; 62 + 63 + meta = { 64 + description = "Allows you to expose a web server running on your local machine to the internet"; 65 + homepage = "https://ngrok.com/"; 66 + downloadPage = "https://ngrok.com/download"; 67 + changelog = "https://ngrok.com/docs/agent/changelog/"; 68 + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 69 + license = lib.licenses.unfree; 70 + platforms = lib.platforms.unix; 71 + maintainers = with lib.maintainers; [ 72 + bobvanderlinden 73 + brodes 74 + ]; 75 + mainProgram = "ngrok"; 76 + }; 77 + }
+34
pkgs/by-name/ng/ngrok/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p jq xh 3 + 4 + set -eu -o pipefail 5 + 6 + cd "$(dirname "${BASH_SOURCE[0]}")" 7 + 8 + get_download_info() { 9 + xh --json \ 10 + https://update.equinox.io/check \ 11 + 'Accept:application/json; q=1; version=1; charset=utf-8' \ 12 + 'Content-Type:application/json; charset=utf-8' \ 13 + app_id=app_c3U4eZcDbjV \ 14 + channel=stable \ 15 + os="$1" \ 16 + goarm= \ 17 + arch="$2" | 18 + jq --arg sys "$1-$2" '{ 19 + sys: $sys, 20 + url: .download_url, 21 + sha256: .checksum, 22 + version: .release.version 23 + }' 24 + } 25 + 26 + ( 27 + get_download_info linux 386 28 + get_download_info linux amd64 29 + get_download_info linux arm 30 + get_download_info linux arm64 31 + get_download_info darwin amd64 32 + get_download_info darwin arm64 33 + ) | jq --slurp 'map ({ (.sys): . }) | add' \ 34 + >versions.json
+38
pkgs/by-name/ng/ngrok/versions.json
··· 1 + { 2 + "linux-386": { 3 + "sys": "linux-386", 4 + "url": "https://bin.equinox.io/a/cYxmmhtKymA/ngrok-v3-3.13.0-linux-386", 5 + "sha256": "f434e84e1e7a37aa9f35d9f3b6a1b3cb36374efbfc309fe2819e36608157ed90", 6 + "version": "3.13.0" 7 + }, 8 + "linux-amd64": { 9 + "sys": "linux-amd64", 10 + "url": "https://bin.equinox.io/a/cL3Y3magKAa/ngrok-v3-3.13.0-linux-amd64", 11 + "sha256": "cff5ff71db0191b8fcea1acdbbec70cd2cae57c670343161a9c10761d95a102e", 12 + "version": "3.13.0" 13 + }, 14 + "linux-arm": { 15 + "sys": "linux-arm", 16 + "url": "https://bin.equinox.io/a/bsi3rM6xj2X/ngrok-v3-3.13.0-linux-arm", 17 + "sha256": "5d82d847795ad85f0b7d8768e5f6fb8cd8668fc58e4f1434de4601b4e6c920af", 18 + "version": "3.13.0" 19 + }, 20 + "linux-arm64": { 21 + "sys": "linux-arm64", 22 + "url": "https://bin.equinox.io/a/isHcV5N1inu/ngrok-v3-3.13.0-linux-arm64", 23 + "sha256": "cc827724c59fe508cec6f8b16a22dba5c06171acadc224034679f9cc34b13c03", 24 + "version": "3.13.0" 25 + }, 26 + "darwin-amd64": { 27 + "sys": "darwin-amd64", 28 + "url": "https://bin.equinox.io/a/bYybffm9EV8/ngrok-v3-3.13.0-darwin-amd64", 29 + "sha256": "e03fff765e0af568f4131ccf3abe5c5f93fc3b0ebad5a10e115c8012cdb1482b", 30 + "version": "3.13.0" 31 + }, 32 + "darwin-arm64": { 33 + "sys": "darwin-arm64", 34 + "url": "https://bin.equinox.io/a/2w7pzTmD25A/ngrok-v3-3.13.0-darwin-arm64", 35 + "sha256": "aa03fec3b1c111c799d0f5be95a80325ad08448a928b3985fa8a27578cf4b883", 36 + "version": "3.13.0" 37 + } 38 + }
-47
pkgs/tools/networking/ngrok/default.nix
··· 1 - { lib, stdenv, fetchurl }: 2 - 3 - let versions = lib.importJSON ./versions.json; 4 - arch = if stdenv.isi686 then "386" 5 - else if stdenv.isx86_64 then "amd64" 6 - else if stdenv.isAarch32 then "arm" 7 - else if stdenv.isAarch64 then "arm64" 8 - else throw "Unsupported architecture"; 9 - os = if stdenv.isLinux then "linux" 10 - else if stdenv.isDarwin then "darwin" 11 - else throw "Unsupported os"; 12 - versionInfo = versions."${os}-${arch}"; 13 - inherit (versionInfo) version sha256 url; 14 - 15 - in 16 - stdenv.mkDerivation { 17 - pname = "ngrok"; 18 - inherit version; 19 - 20 - # run ./update 21 - src = fetchurl { inherit sha256 url; }; 22 - 23 - sourceRoot = "."; 24 - 25 - unpackPhase = "cp $src ngrok"; 26 - 27 - buildPhase = "chmod a+x ngrok"; 28 - 29 - installPhase = '' 30 - install -D ngrok $out/bin/ngrok 31 - ''; 32 - 33 - passthru.updateScript = ./update.sh; 34 - 35 - # Stripping causes SEGFAULT on x86_64-darwin 36 - dontStrip = true; 37 - 38 - meta = with lib; { 39 - description = "Allows you to expose a web server running on your local machine to the internet"; 40 - homepage = "https://ngrok.com/"; 41 - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 42 - license = licenses.unfree; 43 - platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; 44 - maintainers = with maintainers; [ bobvanderlinden brodes ]; 45 - mainProgram = "ngrok"; 46 - }; 47 - }
-34
pkgs/tools/networking/ngrok/update.sh
··· 1 - #!/usr/bin/env nix-shell 2 - #!nix-shell -p httpie 3 - #!nix-shell -p jq 4 - #!nix-shell -i bash 5 - 6 - set -eu -o pipefail 7 - 8 - get_download_info() { 9 - http --body \ 10 - https://update.equinox.io/check \ 11 - 'Accept:application/json; q=1; version=1; charset=utf-8' \ 12 - 'Content-Type:application/json; charset=utf-8' \ 13 - app_id=app_c3U4eZcDbjV \ 14 - channel=stable \ 15 - os=$1 \ 16 - goarm= \ 17 - arch=$2 \ 18 - | jq --arg sys "$1-$2" '{ 19 - sys: $sys, 20 - url: .download_url, 21 - sha256: .checksum, 22 - version: .release.version 23 - }' 24 - } 25 - 26 - ( 27 - get_download_info linux 386 28 - get_download_info linux amd64 29 - get_download_info linux arm 30 - get_download_info linux arm64 31 - get_download_info darwin amd64 32 - get_download_info darwin arm64 33 - ) | jq --slurp 'map ({ (.sys): . }) | add' \ 34 - > pkgs/tools/networking/ngrok/versions.json
-38
pkgs/tools/networking/ngrok/versions.json
··· 1 - { 2 - "linux-386": { 3 - "sys": "linux-386", 4 - "url": "https://bin.equinox.io/a/9uULeng4k9u/ngrok-v3-3.10.1-linux-386", 5 - "sha256": "806700e4c1aa5d6cb10d2ef1ed8079a2e2e8e6d1198f313b0df389589356fcf7", 6 - "version": "3.10.1" 7 - }, 8 - "linux-amd64": { 9 - "sys": "linux-amd64", 10 - "url": "https://bin.equinox.io/a/81d5kzodW8G/ngrok-v3-3.10.1-linux-amd64", 11 - "sha256": "d23ed659469e6f58ed0c34bdbc9846744df908c960f1b1e576cf147345f5e833", 12 - "version": "3.10.1" 13 - }, 14 - "linux-arm": { 15 - "sys": "linux-arm", 16 - "url": "https://bin.equinox.io/a/8iFd8QPGgx1/ngrok-v3-3.10.1-linux-arm", 17 - "sha256": "36dd1a3893552218f21e118902ae3dabbc43a7f2de1d78937e304893d970377b", 18 - "version": "3.10.1" 19 - }, 20 - "linux-arm64": { 21 - "sys": "linux-arm64", 22 - "url": "https://bin.equinox.io/a/c2kv1gi2bti/ngrok-v3-3.10.1-linux-arm64", 23 - "sha256": "86ecd3f4e43c1631a8332a9ee7d629073a7d7bf7412d2d60e1f390f7b2d30bc1", 24 - "version": "3.10.1" 25 - }, 26 - "darwin-amd64": { 27 - "sys": "darwin-amd64", 28 - "url": "https://bin.equinox.io/a/44qfe6kGiDc/ngrok-v3-3.10.1-darwin-amd64", 29 - "sha256": "fb0676289962f1310d8902e9c42d2d2ad1d653138e00490209bd422471888429", 30 - "version": "3.10.1" 31 - }, 32 - "darwin-arm64": { 33 - "sys": "darwin-arm64", 34 - "url": "https://bin.equinox.io/a/9EoBqwofoME/ngrok-v3-3.10.1-darwin-arm64", 35 - "sha256": "8cee685b259bf32088acee05d6388b912fb10a8e3ba5d99569066ebdad5d5a6f", 36 - "version": "3.10.1" 37 - } 38 - }
-2
pkgs/top-level/all-packages.nix
··· 10771 10771 10772 10772 ngrep = callPackage ../tools/networking/ngrep { }; 10773 10773 10774 - ngrok = callPackage ../tools/networking/ngrok { }; 10775 - 10776 10774 nifi = callPackage ../servers/web-apps/nifi { }; 10777 10775 10778 10776 noip = callPackage ../tools/networking/noip { };