about summary refs log tree commit diff
path: root/pkgs/development/tools/azure-static-sites-client
diff options
context:
space:
mode:
authorVincent Haupert <mail@vincent-haupert.de>2022-12-20 13:06:45 +0100
committerVincent Haupert <vincent@yaxi.tech>2022-12-20 13:06:45 +0100
commit8909db923f2b826bb4482fba46f7a6d798c6240c (patch)
tree46e9de19c1e6a29a4120aa5484e445352aa455b4 /pkgs/development/tools/azure-static-sites-client
parent097149393ff12ebd1d54f954c2a3656e5ed80896 (diff)
downloadnixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar.gz
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar.bz2
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar.lz
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar.xz
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.tar.zst
nixlib-8909db923f2b826bb4482fba46f7a6d798c6240c.zip
azure-static-sites-client: init at 1.0.021731
Diffstat (limited to 'pkgs/development/tools/azure-static-sites-client')
-rw-r--r--pkgs/development/tools/azure-static-sites-client/default.nix97
-rwxr-xr-xpkgs/development/tools/azure-static-sites-client/update.sh9
-rw-r--r--pkgs/development/tools/azure-static-sites-client/versions.json59
3 files changed, 165 insertions, 0 deletions
diff --git a/pkgs/development/tools/azure-static-sites-client/default.nix b/pkgs/development/tools/azure-static-sites-client/default.nix
new file mode 100644
index 000000000000..60d151147251
--- /dev/null
+++ b/pkgs/development/tools/azure-static-sites-client/default.nix
@@ -0,0 +1,97 @@
+{ lib
+, stdenv
+, fetchurl
+, autoPatchelfHook
+, curl
+, icu70
+, libkrb5
+, lttng-ust
+, openssl_1_1
+, zlib
+, azure-static-sites-client
+  # "latest", "stable" or "backup"
+, versionFlavor ? "stable"
+}:
+let
+  versions = lib.importJSON ./versions.json;
+  flavor = with lib; head (filter (x: x.version == versionFlavor) versions);
+  fetchBinary = runtimeId: fetchurl {
+    url = flavor.files.${runtimeId}.url;
+    sha256 = flavor.files.${runtimeId}.sha;
+  };
+  sources = {
+    "x86_64-linux" = fetchBinary "linux-x64";
+    "x86_64-darwin" = fetchBinary "macOS";
+  };
+in
+stdenv.mkDerivation {
+  pname = "StaticSitesClient-${versionFlavor}";
+  version = flavor.buildId;
+
+  src = sources.${stdenv.targetPlatform.system} or (throw "Unsupported platform");
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+  ];
+
+  buildInputs = [
+    curl
+    icu70
+    openssl_1_1
+    libkrb5
+    lttng-ust
+    stdenv.cc.cc.lib
+    zlib
+  ];
+
+  dontUnpack = true;
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    install -m755 "$src" -D "$out/bin/StaticSitesClient"
+
+    for icu_lib in 'icui18n' 'icuuc' 'icudata'; do
+      patchelf --add-needed "lib''${icu_lib}.so.${with lib; head (splitVersion (getVersion icu70.name))}" "$out/bin/StaticSitesClient"
+    done
+
+    patchelf --add-needed 'libgssapi_krb5.so' \
+             --add-needed 'liblttng-ust.so'   \
+             --add-needed 'libssl.so.1.1'     \
+             "$out/bin/StaticSitesClient"
+
+    runHook postInstall
+  '';
+
+  # Stripping kills the binary
+  dontStrip = true;
+
+  # Just make sure the binary executes sucessfully
+  doInstallCheck = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+
+    $out/bin/StaticSitesClient version
+
+    runHook postInstallCheck
+  '';
+
+  passthru = {
+    # Create tests for all flavors
+    tests = with lib; genAttrs (map (x: x.version) versions) (versionFlavor:
+      azure-static-sites-client.override { inherit versionFlavor; }
+    );
+    updateScript = ./update.sh;
+  };
+
+  meta = with lib; {
+    description = "Azure static sites client";
+    homepage = "https://github.com/Azure/static-web-apps-cli";
+    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
+    license = licenses.unfree;
+    mainProgram = "StaticSitesClient";
+    maintainers = with maintainers; [ veehaitch ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/development/tools/azure-static-sites-client/update.sh b/pkgs/development/tools/azure-static-sites-client/update.sh
new file mode 100755
index 000000000000..156771e7f12b
--- /dev/null
+++ b/pkgs/development/tools/azure-static-sites-client/update.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl
+
+set -euo pipefail
+
+dirname="$(dirname "$0")"
+
+curl -O --silent --output-dir "$dirname" 'https://swalocaldeploy.azureedge.net/downloads/versions.json'
+echo "" >> "$dirname/versions.json"
diff --git a/pkgs/development/tools/azure-static-sites-client/versions.json b/pkgs/development/tools/azure-static-sites-client/versions.json
new file mode 100644
index 000000000000..0cb5de090269
--- /dev/null
+++ b/pkgs/development/tools/azure-static-sites-client/versions.json
@@ -0,0 +1,59 @@
+[
+  {
+    "version": "latest",
+    "buildId": "1.0.021731",
+    "publishDate": "2022-12-14T02:22:20.0230853Z",
+    "files": {
+      "linux-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/linux/StaticSitesClient",
+        "sha": "d2f88cf8b855169534c7e330dd95385b993b1c0f83331306e685faa8468a82b5"
+      },
+      "win-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/windows/StaticSitesClient.exe",
+        "sha": "525d13ebffd79ea9663a15a4bd2e6d49bca72d20aa44838aa4b83133943d450c"
+      },
+      "osx-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/macOS/StaticSitesClient",
+        "sha": "5de3ac4b205d3871e7a8ff3b5869f2a57002277ac7fa6317032239d114e25ab8"
+      }
+    }
+  },
+  {
+    "version": "stable",
+    "buildId": "1.0.021731",
+    "publishDate": "2022-12-14T02:22:20.0230853Z",
+    "files": {
+      "linux-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/linux/StaticSitesClient",
+        "sha": "d2f88cf8b855169534c7e330dd95385b993b1c0f83331306e685faa8468a82b5"
+      },
+      "win-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/windows/StaticSitesClient.exe",
+        "sha": "525d13ebffd79ea9663a15a4bd2e6d49bca72d20aa44838aa4b83133943d450c"
+      },
+      "osx-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021731/macOS/StaticSitesClient",
+        "sha": "5de3ac4b205d3871e7a8ff3b5869f2a57002277ac7fa6317032239d114e25ab8"
+      }
+    }
+  },
+  {
+    "version": "backup",
+    "buildId": "1.0.021671",
+    "publishDate": "2022-12-08T00:34:47.6310685Z",
+    "files": {
+      "linux-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021671/linux/StaticSitesClient",
+        "sha": "306c2d24cbc6461cdf1fe29e9206ccb9d452ba3514ee9d67a1d7e0f8edbc036f"
+      },
+      "win-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021671/windows/StaticSitesClient.exe",
+        "sha": "ee868ca5e73a6ad8758698c168bb01d07b66288d353813fefe41d441f82b9f1f"
+      },
+      "osx-x64": {
+        "url": "https://swalocaldeploy.azureedge.net/downloads/1.0.021671/macOS/StaticSitesClient",
+        "sha": "5ef513530a45d4b8e135e272f7e7112e900fbb8c8137c19e645a694e71b98c74"
+      }
+    }
+  }
+]