From 7014f1381fe15259ed1e325abe3091c24690457e Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sat, 26 Oct 2024 11:10:16 +0200 Subject: [PATCH] php82Extensions.tideways: init at 5.13.0 --- .../php-packages/tideways/default.nix | 85 +++++++++++++++++++ pkgs/top-level/php-packages.nix | 2 + 2 files changed, 87 insertions(+) create mode 100644 pkgs/development/php-packages/tideways/default.nix diff --git a/pkgs/development/php-packages/tideways/default.nix b/pkgs/development/php-packages/tideways/default.nix new file mode 100644 index 0000000000000..95529df80aba8 --- /dev/null +++ b/pkgs/development/php-packages/tideways/default.nix @@ -0,0 +1,85 @@ +{ stdenvNoCC +, lib +, fetchurl +, autoPatchelfHook +, php +, writeShellApplication +, curl +, gnugrep +, common-updater-scripts +}: + +let + soFile = { + "8.0" = "tideways-php-8.0.so"; + "8.1" = "tideways-php-8.1.so"; + "8.2" = "tideways-php-8.2.so"; + "8.3" = "tideways-php-8.3.so"; + }.${lib.versions.majorMinor php.version} or (throw "Unsupported PHP version."); +in +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "tideways-php"; + extensionName = "tideways"; + version = "5.13.0"; + + src = finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported platform for tideways-php: ${stdenvNoCC.hostPlatform.system}"); + + nativeBuildInputs = lib.optionals stdenvNoCC.isLinux [ + autoPatchelfHook + ]; + + installPhase = '' + runHook preInstall + install -D ${soFile} $out/lib/php/extensions/tideways.so + runHook postInstall + ''; + + passthru = { + sources = { + "x86_64-linux" = fetchurl { + url = "https://s3-eu-west-1.amazonaws.com/tideways/extension/${finalAttrs.version}/tideways-php-${finalAttrs.version}-x86_64.tar.gz"; + hash = "sha256-HiH7EjAOqHIYaIRlp/cemhU+QX9Q66ZX8RpX1qcctZ0="; + }; + "aarch64-linux" = fetchurl { + url = "https://s3-eu-west-1.amazonaws.com/tideways/extension/${finalAttrs.version}/tideways-php-${finalAttrs.version}-arm64.tar.gz"; + hash = "sha256-kntNr8KMrOBK2ZZT/EMTR7MCuRt3rJAqhpt5B0m5qVM="; + }; + "aarch64-darwin" = fetchurl { + url = "https://s3-eu-west-1.amazonaws.com/tideways/extension/${finalAttrs.version}/tideways-php-${finalAttrs.version}-macos-arm.tar.gz"; + hash = "sha256-zNVBTXKwCRLKmDlEUUUpP7feB/n2fMevEuKZrgdyAkw="; + }; + }; + + updateScript = "${ + writeShellApplication { + name = "update-tideways-probe"; + runtimeInputs = [ + curl + gnugrep + common-updater-scripts + ]; + text = '' + NEW_VERSION=$(curl --fail -L https://tideways.com/profiler/downloads | grep -E 'https://tideways.s3.amazonaws.com/extension/[0-9]+\.[0-9]+\.[0-9]+/tideways-php-[0-9]+\.[0-9]+\.[0-9]+-x86_64.tar.gz' | grep -oP 'extension/\K[0-9]+\.[0-9]+\.[0-9]+') + + if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then + echo "The new version same as the old version." + exit 0 + fi + + for platform in ${lib.escapeShellArgs finalAttrs.meta.platforms}; do + update-source-version "php82Extensions.tideways" "$NEW_VERSION" --ignore-same-version --source-key="sources.$platform" + done + ''; + } + }/bin/update-tideways-probe"; + }; + + meta = with lib; { + description = "Tideways PHP Probe"; + homepage = "https://tideways.com/"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.unfree; + maintainers = with maintainers; [ shyim ]; + platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; + }; +}) \ No newline at end of file diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 0e4fc0b6ecaef..b6fa2b4f45bbd 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -355,6 +355,8 @@ in { swoole = callPackage ../development/php-packages/swoole { }; + tideways = callPackage ../development/php-packages/tideways { }; + uv = callPackage ../development/php-packages/uv { }; vld = callPackage ../development/php-packages/vld { };