Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tideways-cli: init at 1.2.2 #351192

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions pkgs/by-name/ti/tideways-cli/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
stdenvNoCC,
lib,
fetchurl,
curl,
common-updater-scripts,
writeShellApplication,
gnugrep,
installShellFiles,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "tideways-cli";
version = "1.2.2";

nativeBuildInputs = [ installShellFiles ];

src =
finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported platform for tideways-cli: ${stdenvNoCC.hostPlatform.system}");

installPhase = ''
runHook preInstall

mkdir -p $out/bin
cp tideways $out/bin/tideways
chmod +x $out/bin/tideways

installShellCompletion --cmd tideways \
--bash <($out/bin/tideways completion bash) \
--zsh <($out/bin/tideways completion zsh) \
--fish <($out/bin/tideways completion fish)

runHook postInstall
'';

passthru = {
sources = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in passthru and not in a let...in ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise the common-updater-scripts cannot find it.

error: attribute 'sources' in selection path 'tideways-cli.sources.x86_64-linux.drvAttrs.outputHash' not found
update-source-version: error: Couldn't evaluate old source hash from 'tideways-cli.sources.x86_64-linux'!

"x86_64-linux" = fetchurl {
url = "https://s3-eu-west-1.amazonaws.com/tideways/cli/${finalAttrs.version}/tideways-cli_linux_amd64-${finalAttrs.version}.tar.gz";
hash = "sha256-g06PE464P/A0PDGG7xMa644ztcIRMAU/ueee2IOhiHc=";
};
"aarch64-linux" = fetchurl {
url = "https://s3-eu-west-1.amazonaws.com/tideways/cli/${finalAttrs.version}/tideways-cli_linux_arm64-${finalAttrs.version}.tar.gz";
hash = "sha256-nbC9vMXA5vHKxEpINDQJTUqh7YOe0T0x5MbbQg03gk4=";
};
"x86_64-darwin" = fetchurl {
url = "https://s3-eu-west-1.amazonaws.com/tideways/cli/${finalAttrs.version}/tideways-cli_macos_amd64-${finalAttrs.version}.tar.gz";
hash = "sha256-RfCTl61r/zfWy/3W+zmrSaAjIWe52POfZnzsmm5loD4=";
};
"aarch64-darwin" = fetchurl {
url = "https://s3-eu-west-1.amazonaws.com/tideways/cli/${finalAttrs.version}/tideways-cli_macos_arm64-${finalAttrs.version}.tar.gz";
hash = "sha256-4N4hUvbf8b9BnKUY4YTsB76Z35DmSTyWv6BC+bqJNCI=";
};
};

updateScript = "${
writeShellApplication {
name = "update-tideways-cli";
runtimeInputs = [
curl
gnugrep
common-updater-scripts
];
text = ''
NEW_VERSION=$(curl --fail -L -s https://tideways.com/profiler/downloads | grep -E 'https://tideways.s3.amazonaws.com/cli/([0-9]+\.[0-9]+\.[0-9]+)/tideways-cli_linux_amd64-\1.tar.gz' | grep -oP 'cli/\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 "tideways-cli" "$NEW_VERSION" --ignore-same-version --source-key="sources.$platform"
done
'';
}
}/bin/update-tideways-cli";
};

meta = with lib; {
description = "Tideways Profiler CLI";
homepage = "https://tideways.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
mainProgram = "tideways";
license = licenses.unfree;
maintainers = with maintainers; [ shyim ];
platforms = lib.attrNames finalAttrs.passthru.sources;
};
})
75 changes: 75 additions & 0 deletions pkgs/by-name/ti/tideways-daemon/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
stdenvNoCC,
lib,
fetchurl,
curl,
common-updater-scripts,
writeShellApplication,
gnugrep,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "tideways-daemon";
version = "1.9.18";

src =
finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported platform for tideways-cli: ${stdenvNoCC.hostPlatform.system}");

installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp tideways-daemon $out/bin/tideways-daemon
chmod +x $out/bin/tideways-daemon
runHook postInstall
'';

passthru = {
sources = {
"x86_64-linux" = fetchurl {
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_linux_amd64-${finalAttrs.version}.tar.gz";
hash = "sha256-CFVHD2CfY1yOP621PzkflvapCrIuqY0rtTgm20xW41E=";
};
"aarch64-linux" = fetchurl {
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_linux_aarch64-${finalAttrs.version}.tar.gz";
hash = "sha256-59quxF5rClfw8xd8mT2jU1/DVatrZyJw7Rj6pikKXF0=";
};
"aarch64-darwin" = fetchurl {
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_macos_arm64-${finalAttrs.version}.tar.gz";
hash = "sha256-4h7Vn9s8Y63M1BnzwjcxSV8ydRqhNeJnFvG9Cs1Cq8Q=";
};
};
updateScript = "${
writeShellApplication {
name = "update-tideways-daemon";
runtimeInputs = [
curl
gnugrep
common-updater-scripts
];
text = ''
NEW_VERSION=$(curl --fail -L -s https://tideways.com/profiler/downloads | grep -E 'https://tideways.s3.amazonaws.com/daemon/([0-9]+\.[0-9]+\.[0-9]+)/tideways-daemon_linux_amd64-\1.tar.gz' | grep -oP 'daemon/\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 "tideways-daemon" "$NEW_VERSION" --ignore-same-version --source-key="sources.$platform"
done
'';
}
}/bin/update-tideways-daemon";
};

meta = with lib; {
description = "Tideways Daemon";
homepage = "https://tideways.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
mainProgram = "tideways-daemon";
license = licenses.unfree;
maintainers = with maintainers; [ shyim ];
platforms = lib.attrNames finalAttrs.passthru.sources;
};
})
90 changes: 90 additions & 0 deletions pkgs/development/php-packages/tideways/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
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 = lib.attrNames finalAttrs.passthru.sources;
};
})
2 changes: 2 additions & 0 deletions pkgs/top-level/php-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,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 { };
Expand Down