depot/third_party/nixpkgs/pkgs/development/tools/azure-static-sites-client/default.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

97 lines
2.3 KiB
Nix

{ lib
, stdenv
, fetchurl
, autoPatchelfHook
, curl
, icu70
, libkrb5
, lttng-ust
, openssl
, zlib
, azure-static-sites-client
# "latest", "stable" or "backup"
, versionFlavor ? "stable"
}:
let
versions = lib.importJSON ./versions.json;
flavor = lib.head (lib.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 "osx-x64";
};
in
stdenv.mkDerivation {
pname = "StaticSitesClient-${versionFlavor}";
version = flavor.buildId;
src = sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
curl
icu70
libkrb5
lttng-ust
openssl
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.${lib.head (lib.splitVersion (lib.getVersion icu70.name))}" "$out/bin/StaticSitesClient"
done
patchelf --add-needed 'libgssapi_krb5.so' \
--add-needed 'liblttng-ust.so' \
--add-needed 'libssl.so.3' \
"$out/bin/StaticSitesClient"
runHook postInstall
'';
# Stripping kills the binary
dontStrip = true;
# Just make sure the binary executes successfully
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/StaticSitesClient version
runHook postInstallCheck
'';
passthru = {
# Create tests for all flavors
tests = lib.genAttrs (map (x: x.version) versions) (versionFlavor:
azure-static-sites-client.override { inherit versionFlavor; }
);
updateScript = ./update.sh;
};
meta = {
description = "Azure static sites client";
homepage = "https://github.com/Azure/static-web-apps-cli";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
mainProgram = "StaticSitesClient";
maintainers = with lib.maintainers; [ veehaitch ];
platforms = [ "x86_64-linux" ];
};
}