blob: 0cf95d40d6975b166a3f995352c79388d307fa7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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.20.0";
src =
finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported platform for tideways-php: ${stdenvNoCC.hostPlatform.system}");
nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.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-uAmsmz+4tsCGw4jlzyZbUNjuzBU/HcIDWrHCC+0t4Xw=";
};
"aarch64-linux" = fetchurl {
url = "https://s3-eu-west-1.amazonaws.com/tideways/extension/${finalAttrs.version}/tideways-php-${finalAttrs.version}-arm64.tar.gz";
hash = "sha256-gPhr32G6h/U1uR/aaeIWpOaDV9HF8EbQF7p1kJ5SDis=";
};
"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-VfgX1SNYKoFR290gRoRXfD5CoLhDPkK+3+4o13P1kiM=";
};
};
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 = {
description = "Tideways PHP Probe";
homepage = "https://tideways.com/";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ shyim ];
platforms = lib.attrNames finalAttrs.passthru.sources;
};
})
|