1{ lib
2, stdenv
3, binutils
4, cmake
5, extra-cmake-modules
6, patchelfUnstable
7, wrapQtAppsHook
8, elfutils
9, fetchFromGitHub
10, fetchpatch
11, kconfigwidgets
12, kddockwidgets
13, ki18n
14, kio
15, kitemmodels
16, kitemviews
17, kparts
18, kwindowsystem
19, libelf
20, linuxPackages
21, qtbase
22, qtsvg
23, rustc-demangle
24, syntax-highlighting
25, threadweaver
26, zstd
27}:
28
29stdenv.mkDerivation rec {
30 pname = "hotspot";
31 version = "1.5.0";
32
33 src = fetchFromGitHub {
34 owner = "KDAB";
35 repo = "hotspot";
36 rev = "refs/tags/v${version}";
37 hash = "sha256-FJkDPWqNwoWg/15tvMnwke7PVtWVuqT0gtJBFQE0qZ4=";
38 fetchSubmodules = true;
39 };
40
41 patches = [
42 # Backport stuck UI bug fix
43 # FIXME: remove in next update
44 (fetchpatch {
45 url = "https://github.com/KDAB/hotspot/commit/7639dee8617dba9b88182c7ff4887e8d3714ac98.patch";
46 hash = "sha256-aAo9uEy+MBztMhnC5jB08moZBeRCENU22R39pqSBXOY=";
47 })
48 ];
49
50 nativeBuildInputs = [
51 cmake
52 extra-cmake-modules
53 # stable patchelf corrupts the binary
54 patchelfUnstable
55 wrapQtAppsHook
56 ];
57
58 buildInputs = [
59 (elfutils.override { enableDebuginfod = true; }) # perfparser needs to find debuginfod.h
60 kconfigwidgets
61 kddockwidgets
62 ki18n
63 kio
64 kitemmodels
65 kitemviews
66 kparts
67 kwindowsystem
68 libelf
69 qtbase
70 qtsvg
71 rustc-demangle
72 syntax-highlighting
73 threadweaver
74 zstd
75 ];
76
77 qtWrapperArgs = [
78 "--suffix PATH : ${lib.makeBinPath [ linuxPackages.perf binutils ]}"
79 ];
80
81 preFixup = ''
82 patchelf \
83 --add-rpath ${lib.makeLibraryPath [ rustc-demangle ]} \
84 --add-needed librustc_demangle.so \
85 $out/libexec/hotspot-perfparser
86 '';
87
88 meta = with lib; {
89 description = "A GUI for Linux perf";
90 mainProgram = "hotspot";
91 longDescription = ''
92 hotspot is a GUI replacement for `perf report`.
93 It takes a perf.data file, parses and evaluates its contents and
94 then displays the result in a graphical way.
95 '';
96 homepage = "https://github.com/KDAB/hotspot";
97 changelog = "https://github.com/KDAB/hotspot/releases/tag/v${version}";
98 license = with licenses; [ gpl2Only gpl3Only ];
99 platforms = platforms.linux;
100 maintainers = with maintainers; [ nh2 ];
101 };
102}