about summary refs log tree commit diff
path: root/pkgs/by-name/ng
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ng')
-rw-r--r--pkgs/by-name/ng/nginx-language-server/package.nix1
-rw-r--r--pkgs/by-name/ng/ngrok/package.nix77
-rwxr-xr-xpkgs/by-name/ng/ngrok/update.sh34
-rw-r--r--pkgs/by-name/ng/ngrok/versions.json38
4 files changed, 149 insertions, 1 deletions
diff --git a/pkgs/by-name/ng/nginx-language-server/package.nix b/pkgs/by-name/ng/nginx-language-server/package.nix
index 891d6e4d5cb61..39a5a55f5abd9 100644
--- a/pkgs/by-name/ng/nginx-language-server/package.nix
+++ b/pkgs/by-name/ng/nginx-language-server/package.nix
@@ -17,7 +17,6 @@ python3.pkgs.buildPythonApplication rec {
 
   build-system = with python3.pkgs; [
     poetry-core
-    pythonRelaxDepsHook
   ];
 
   pythonRelaxDeps = [
diff --git a/pkgs/by-name/ng/ngrok/package.nix b/pkgs/by-name/ng/ngrok/package.nix
new file mode 100644
index 0000000000000..daf9da5c8f2f5
--- /dev/null
+++ b/pkgs/by-name/ng/ngrok/package.nix
@@ -0,0 +1,77 @@
+{
+  lib,
+  stdenv,
+  fetchurl,
+}:
+
+let
+  versions = lib.importJSON ./versions.json;
+  arch =
+    if stdenv.isi686 then
+      "386"
+    else if stdenv.isx86_64 then
+      "amd64"
+    else if stdenv.isAarch32 then
+      "arm"
+    else if stdenv.isAarch64 then
+      "arm64"
+    else
+      throw "Unsupported architecture";
+  os =
+    if stdenv.isLinux then
+      "linux"
+    else if stdenv.isDarwin then
+      "darwin"
+    else
+      throw "Unsupported os";
+  versionInfo = versions."${os}-${arch}";
+  inherit (versionInfo) version sha256 url;
+
+in
+stdenv.mkDerivation {
+  pname = "ngrok";
+  inherit version;
+
+  # run ./update
+  src = fetchurl { inherit sha256 url; };
+
+  sourceRoot = ".";
+
+  unpackPhase = ''
+    runHook preUnpack
+    cp $src ngrok
+    runHook postUnpack
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+    chmod a+x ngrok
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    install -D ngrok $out/bin/ngrok
+    runHook postInstall
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  # Stripping causes SEGFAULT on darwin
+  dontStrip = stdenv.isDarwin;
+
+  meta = {
+    description = "Allows you to expose a web server running on your local machine to the internet";
+    homepage = "https://ngrok.com/";
+    downloadPage = "https://ngrok.com/download";
+    changelog = "https://ngrok.com/docs/agent/changelog/";
+    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
+    license = lib.licenses.unfree;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [
+      bobvanderlinden
+      brodes
+    ];
+    mainProgram = "ngrok";
+  };
+}
diff --git a/pkgs/by-name/ng/ngrok/update.sh b/pkgs/by-name/ng/ngrok/update.sh
new file mode 100755
index 0000000000000..60649faf05cba
--- /dev/null
+++ b/pkgs/by-name/ng/ngrok/update.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p jq xh
+
+set -eu -o pipefail
+
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+get_download_info() {
+    xh --json \
+        https://update.equinox.io/check \
+        'Accept:application/json; q=1; version=1; charset=utf-8' \
+        'Content-Type:application/json; charset=utf-8' \
+        app_id=app_c3U4eZcDbjV \
+        channel=stable \
+        os="$1" \
+        goarm= \
+        arch="$2" |
+        jq --arg sys "$1-$2" '{
+        sys: $sys,
+        url: .download_url,
+        sha256: .checksum,
+        version: .release.version
+    }'
+}
+
+(
+    get_download_info linux 386
+    get_download_info linux amd64
+    get_download_info linux arm
+    get_download_info linux arm64
+    get_download_info darwin amd64
+    get_download_info darwin arm64
+) | jq --slurp 'map ({ (.sys): . }) | add' \
+    >versions.json
diff --git a/pkgs/by-name/ng/ngrok/versions.json b/pkgs/by-name/ng/ngrok/versions.json
new file mode 100644
index 0000000000000..1b1ef45e785ca
--- /dev/null
+++ b/pkgs/by-name/ng/ngrok/versions.json
@@ -0,0 +1,38 @@
+{
+  "linux-386": {
+    "sys": "linux-386",
+    "url": "https://bin.equinox.io/a/bCqkEJHChUv/ngrok-v3-3.14.0-linux-386",
+    "sha256": "0fc0fcb097ae9caa47b8887e4aca71ce3850bc97343cea93b8cf13d48d5d7c5a",
+    "version": "3.14.0"
+  },
+  "linux-amd64": {
+    "sys": "linux-amd64",
+    "url": "https://bin.equinox.io/a/8oZyZn8Sh2k/ngrok-v3-3.14.0-linux-amd64",
+    "sha256": "80d5ea4de774ad7f579d7381a492b6531c1d83c2a0476d236bd87b1aaaac3c7e",
+    "version": "3.14.0"
+  },
+  "linux-arm": {
+    "sys": "linux-arm",
+    "url": "https://bin.equinox.io/a/cMuwPWbrN4a/ngrok-v3-3.14.0-linux-arm",
+    "sha256": "8baeb05eab0bf3c4adde0a3aba63ec21cdd53f2ade8d1b556dea716597242fb1",
+    "version": "3.14.0"
+  },
+  "linux-arm64": {
+    "sys": "linux-arm64",
+    "url": "https://bin.equinox.io/a/3H9YcER9Em2/ngrok-v3-3.14.0-linux-arm64",
+    "sha256": "021e698af6ccff051184e72bf02de4a5ce45b8e4ace28e000f004e8af841db23",
+    "version": "3.14.0"
+  },
+  "darwin-amd64": {
+    "sys": "darwin-amd64",
+    "url": "https://bin.equinox.io/a/25F8KjXtZLM/ngrok-v3-3.14.0-darwin-amd64",
+    "sha256": "f82d9521e8cb4d8e08b0a2b7d7f6ff4c4db2123c64d9e02ed59de71b8c6f98c5",
+    "version": "3.14.0"
+  },
+  "darwin-arm64": {
+    "sys": "darwin-arm64",
+    "url": "https://bin.equinox.io/a/3bTR91HsBHY/ngrok-v3-3.14.0-darwin-arm64",
+    "sha256": "da5112d50a4b4d27163373effff66a09acaa966a733be4197cc96ca5776432fa",
+    "version": "3.14.0"
+  }
+}