Skip to content

Commit b59b8fc

Browse files
committed
tideways-daemon: init at 1.9.18
1 parent 880de99 commit b59b8fc

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
stdenvNoCC,
3+
lib,
4+
fetchurl,
5+
curl,
6+
common-updater-scripts,
7+
writeShellApplication,
8+
gnugrep,
9+
}:
10+
11+
stdenvNoCC.mkDerivation (finalAttrs: {
12+
pname = "tideways-daemon";
13+
version = "1.9.18";
14+
15+
src =
16+
finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system}
17+
or (throw "Unsupported platform for tideways-cli: ${stdenvNoCC.hostPlatform.system}");
18+
19+
installPhase = ''
20+
runHook preInstall
21+
mkdir -p $out/bin
22+
cp tideways-daemon $out/bin/tideways-daemon
23+
chmod +x $out/bin/tideways-daemon
24+
runHook postInstall
25+
'';
26+
27+
passthru = {
28+
sources = {
29+
"x86_64-linux" = fetchurl {
30+
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_linux_amd64-${finalAttrs.version}.tar.gz";
31+
hash = "sha256-CFVHD2CfY1yOP621PzkflvapCrIuqY0rtTgm20xW41E=";
32+
};
33+
"aarch64-linux" = fetchurl {
34+
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_linux_aarch64-${finalAttrs.version}.tar.gz";
35+
hash = "sha256-59quxF5rClfw8xd8mT2jU1/DVatrZyJw7Rj6pikKXF0=";
36+
};
37+
"aarch64-darwin" = fetchurl {
38+
url = "https://tideways.s3.amazonaws.com/daemon/${finalAttrs.version}/tideways-daemon_macos_arm64-${finalAttrs.version}.tar.gz";
39+
hash = "sha256-4h7Vn9s8Y63M1BnzwjcxSV8ydRqhNeJnFvG9Cs1Cq8Q=";
40+
};
41+
};
42+
updateScript = "${
43+
writeShellApplication {
44+
name = "update-tideways-daemon";
45+
runtimeInputs = [
46+
curl
47+
gnugrep
48+
common-updater-scripts
49+
];
50+
text = ''
51+
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]+')
52+
53+
if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then
54+
echo "The new version same as the old version."
55+
exit 0
56+
fi
57+
58+
for platform in ${lib.escapeShellArgs finalAttrs.meta.platforms}; do
59+
update-source-version "tideways-daemon" "$NEW_VERSION" --ignore-same-version --source-key="sources.$platform"
60+
done
61+
'';
62+
}
63+
}/bin/update-tideways-daemon";
64+
};
65+
66+
meta = with lib; {
67+
description = "Tideways Daemon";
68+
homepage = "https://tideways.com/";
69+
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
70+
mainProgram = "tideways-daemon";
71+
license = licenses.unfree;
72+
maintainers = with maintainers; [ shyim ];
73+
platforms = lib.attrNames finalAttrs.passthru.sources;
74+
};
75+
})

0 commit comments

Comments
 (0)