at master 104 lines 2.7 kB view raw
1{ 2 fetchzip, 3 lib, 4 stdenvNoCC, 5 copyDesktopItems, 6 imagemagick, 7 makeDesktopItem, 8 jdk21, 9}: 10let 11 jre = jdk21; 12 13 vPath = v: lib.elemAt (lib.splitString "-" v) 0; 14 15 version = "2025.3-b154"; 16 17 arches = { 18 aarch64-linux = "arm64"; 19 x86_64-linux = "x64"; 20 }; 21 22 arch = arches.${stdenvNoCC.targetPlatform.system} or (throw "Unsupported system"); 23 24 hashes = { 25 arm64 = "sha256-X9YQy12rfTWOVKX2ufmS4GxLGp/I6jhZAZyRBfLuOuk="; 26 x64 = "sha256-BuEfpMEgkOcbUra6eT/sTiVhXpheMaCe55M/CuG0kHE="; 27 }; 28 29 desktopItem = makeDesktopItem { 30 name = "YourKit Java Profiler"; 31 desktopName = "YourKit Java Profiler " + version; 32 type = "Application"; 33 exec = "yourkit-java-profiler %f"; 34 icon = "yourkit-java-profiler"; 35 categories = [ 36 "Development" 37 "Java" 38 "Profiling" 39 ]; 40 terminal = false; 41 startupWMClass = "YourKit Java Profiler"; 42 }; 43in 44stdenvNoCC.mkDerivation { 45 inherit version; 46 47 pname = "yourkit-java"; 48 49 src = fetchzip { 50 url = "https://download.yourkit.com/yjp/${vPath version}/YourKit-JavaProfiler-${version}-${arch}.zip"; 51 hash = hashes.${arch}; 52 }; 53 54 nativeBuildInputs = [ 55 copyDesktopItems 56 imagemagick 57 ]; 58 59 buildInputs = [ jre ]; 60 61 desktopItems = [ desktopItem ]; 62 63 installPhase = '' 64 runHook preInstall 65 66 mkdir -p $out 67 cp -pr bin lib license.html license-redist.txt probes samples $out 68 cp ${./forbid-desktop-item-creation} $out/bin/forbid-desktop-item-creation 69 mv $out/bin/profiler.sh $out/bin/yourkit-java-profiler 70 mkdir -p $out/share/icons 71 convert $out/bin/profiler.ico\[0] \ 72 -size 256x256 \ 73 $out/share/icons/yourkit-java-profiler.png 74 rm $out/bin/profiler.ico 75 rm -rf $out/bin/{windows-*,mac,linux-{*-32,musl-*,ppc-*}} 76 if [[ ${arch} = x64 ]]; then 77 rm -rf $out/bin/linux-arm-64 78 else 79 rm -rf $out/bin/linux-x86-64 80 fi 81 substituteInPlace $out/bin/yourkit-java-profiler \ 82 --replace 'JAVA_EXE="$YD/jre64/bin/java"' JAVA_EXE=${jre}/bin/java 83 # Use our desktop item, which will be purged when this package 84 # gets removed 85 sed -i -e "/^YD=/isource $out/bin/forbid-desktop-item-creation\\ 86 " \ 87 $out/bin/yourkit-java-profiler 88 89 runHook postInstall 90 ''; 91 92 passthru.updateScript = ./update.sh; 93 94 meta = with lib; { 95 description = "Award winning, fully featured low overhead profiler for Java EE and Java SE platforms"; 96 homepage = "https://www.yourkit.com"; 97 changelog = "https://www.yourkit.com/changes/"; 98 license = licenses.unfree; 99 mainProgram = "yourkit-java-profiler"; 100 platforms = attrNames arches; 101 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 102 maintainers = with maintainers; [ herberteuler ]; 103 }; 104}