-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
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 = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
"aarch64-darwin" | ||
]; | ||
}; | ||
}) |