1{ stdenv, fetchzip, lib, makeWrapper, jdk, gtk2, gawk }:
2
3stdenv.mkDerivation rec {
4 name = "visualvm-1.3.9";
5
6 src = fetchzip {
7 url = "https://github.com/visualvm/visualvm.src/releases/download/1.3.9/visualvm_139.zip";
8 sha256 = "1gkdkxssh51jczhgv680i42jjrlia1vbpcqhxvf45xcq9xj95bm5";
9 };
10
11 nativeBuildInputs = [ makeWrapper ];
12
13 installPhase = ''
14 rm bin/visualvm.exe
15 rm platform/lib/nbexec64.exe
16 rm platform/lib/nbexec.exe
17 rm profiler/lib/deployed/jdk15/windows-amd64/profilerinterface.dll
18 rm profiler/lib/deployed/jdk15/windows/profilerinterface.dll
19 rm profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll
20 rm profiler/lib/deployed/jdk16/windows/profilerinterface.dll
21 rm platform/modules/lib/amd64/jnidispatch-410.dll
22 rm platform/modules/lib/x86/jnidispatch-410.dll
23 rm platform/lib/nbexec.dll
24 rm platform/lib/nbexec64.dll
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 ];
54 };
55}