1{ stdenv, fetchzip, lib, makeWrapper, makeDesktopItem, jdk, gtk2, gawk }:
2
3stdenv.mkDerivation rec {
4 version = "1.4.1";
5 name = "visualvm-${version}";
6
7 src = fetchzip {
8 url = "https://github.com/visualvm/visualvm.src/releases/download/${version}/visualvm_${builtins.replaceStrings ["."] [""] version}.zip";
9 sha256 = "10ciyggf8mcy3c53shpl03fxqwsa2ilgw3xdgqhb1ah151k18p78";
10 };
11
12 desktopItem = makeDesktopItem {
13 name = "visualvm";
14 exec = "visualvm";
15 comment = "Java Troubleshooting Tool";
16 desktopName = "VisualVM";
17 genericName = "Java Troubleshooting Tool";
18 categories = "Application;Development;";
19 };
20
21 nativeBuildInputs = [ makeWrapper ];
22
23 installPhase = ''
24 find . -type f -name "*.dll" -o -name "*.exe" -delete;
25
26 substituteInPlace etc/visualvm.conf \
27 --replace "#visualvm_jdkhome=" "visualvm_jdkhome=" \
28 --replace "/path/to/jdk" "${jdk.home}" \
29 --replace 'visualvm_default_options="' 'visualvm_default_options="--laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel -J-Dawt.useSystemAAFontSettings=lcd -J-Dswing.aatext=true '
30
31 substituteInPlace platform/lib/nbexec \
32 --replace /usr/bin/\''${awk} ${gawk}/bin/awk
33
34 cp -r . $out
35
36 # To get the native LAF, JVM needs to see GTK’s .so-s.
37 wrapProgram $out/bin/visualvm \
38 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gtk2 ]}"
39 '';
40
41 meta = with stdenv.lib; {
42 description = "A visual interface for viewing information about Java applications";
43 longDescription = ''
44 VisualVM is a visual tool integrating several commandline JDK
45 tools and lightweight profiling capabilities. Designed for both
46 production and development time use, it further enhances the
47 capability of monitoring and performance analysis for the Java
48 SE platform.
49 '';
50 homepage = https://visualvm.java.net/;
51 license = licenses.gpl2ClasspathPlus;
52 platforms = platforms.all;
53 maintainers = with maintainers; [ michalrus moaxcp ];
54 };
55}