Skip to content

Instantly share code, notes, and snippets.

@siers
Last active September 7, 2021 15:10
Show Gist options
  • Save siers/e54d47d397ec2a0cd4353a852fad69c3 to your computer and use it in GitHub Desktop.
Save siers/e54d47d397ec2a0cd4353a852fad69c3 to your computer and use it in GitHub Desktop.
YourKit Java profiler Nix/NixOS package
{ stdenv, fetchzip, zlib, openjdk8, openjdk11, version ? "v2019" }:
# https://www.yourkit.com/docs/java/help/running_profiler.jsp
let
versions = {
v2019 = {
date = "2019.1";
buildnr = "b133";
sha256 = "06p8y0mmyfrzjk5jz783gcfjsq6mk4rqddbqxarkkar7va5w5vk6";
openjdk = openjdk8;
};
v2021 = {
date = "2021.3";
buildnr = "b228";
sha256 = "0lw1008msihnxcvgdnqj0xvk0336vd228hgbqjr6srydigl99hlg";
openjdk = openjdk11;
};
};
build = date: buildnr: sha256: openjdk:
let
url = "https://download.yourkit.com/yjp/${date}/YourKit-JavaProfiler-${date}-${buildnr}.zip";
src = fetchzip { inherit url sha256; };
in
stdenv.mkDerivation {
name = "yourkit-${date}-${buildnr}";
inherit src;
buildInputs = [ zlib ];
buildPhase = ''
mkdir -p $out/bin
cp -r $src/{lib,probes,license*} $out
find bin -maxdepth 1 -type f -exec cp {} $out/bin \;
cp -r bin/linux-x86-64/ $out/bin
# why bother fixing linking, when you can fool it with something that works
ln -s ${openjdk}/ $out/jre64
'';
installPhase = ":";
};
in
with versions."${version}"; build date buildnr sha256 openjdk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment