1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p coreutils curl gawk gnused nix-prefetch
6 ROOT
="$(dirname "$
(readlink
-f "$0")")"
8 NIX_DRV
="$ROOT/$DRV_BASE"
9 if [[ ! -f "$NIX_DRV" ]]; then
10 echo "ERROR: cannot find $DRV_BASE in $ROOT"
14 function retrieve_latest_version
() {
15 curl https
://www.yourkit.com
/java
/profiler
/download
/ \
16 |
grep -Eo '(Version|Build): ([a-z0-9#.-])+' \
17 |
awk '{ print $2 }' \
22 function calc_hash
() {
25 nix-prefetch
--option extra-experimental-features flakes \
26 "{ stdenv, fetchzip }:
28 pname = \"yourkit-java-binary\";
29 version = \"$version\";
36 function update_hash
() {
39 local date=$
(echo $version |
sed 's/-.*//')
40 local url
=https
://download.yourkit.com
/yjp
/$date/YourKit-JavaProfiler-
$version-$arch.
zip
41 local hash=$
(calc_hash
$version $url)
42 sed -i -e "s|^.*$arch.*=.*\"sha256-.*$| $arch = \"$hash\";|" $NIX_DRV
45 version
=$
(retrieve_latest_version
)
46 sed -i -e "s|^.*version.*=.*\".*$| version = \"$version\";|" $NIX_DRV
47 for arch
in arm64 x64
; do
48 update_hash
$arch $version
53 # eval: (sh-set-shell "bash")