1{
2 lib,
3 stdenv,
4 mkDerivation,
5 fetchFromGitHub,
6 fetchpatch,
7 cmake,
8 extra-cmake-modules,
9 makeBinaryWrapper,
10 zlib,
11 boost,
12 libunwind,
13 elfutils,
14 sparsehash,
15 zstd,
16 qtbase,
17 kio,
18 kitemmodels,
19 threadweaver,
20 kconfigwidgets,
21 kcoreaddons,
22 kdiagram,
23}:
24
25mkDerivation rec {
26 pname = "heaptrack";
27 version = "1.5.0";
28
29 src = fetchFromGitHub {
30 owner = "KDE";
31 repo = "heaptrack";
32 rev = "v${version}";
33 hash = "sha256-pP+s60ERnmOctYTe/vezCg0VYzziApNY0QaF3aTccZU=";
34 };
35
36 patches = [
37 # cmake: Fix C compatibility of libunwind probes
38 (fetchpatch {
39 url = "https://invent.kde.org/sdk/heaptrack/-/commit/c6c45f3455a652c38aefa402aece5dafa492e8ab.patch";
40 hash = "sha256-eou53UUQX+S7yrz2RS95GwkAnNIZY/aaze0eAdjnbPU=";
41 })
42 ];
43
44 nativeBuildInputs = [
45 cmake
46 extra-cmake-modules
47 makeBinaryWrapper
48 ];
49 buildInputs =
50 [
51 zlib
52 boost
53 libunwind
54 sparsehash
55 zstd
56 qtbase
57 kio
58 kitemmodels
59 threadweaver
60 kconfigwidgets
61 kcoreaddons
62 kdiagram
63 ]
64 ++ lib.optionals stdenv.hostPlatform.isLinux [
65 elfutils
66 ];
67
68 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
69 makeWrapper \
70 $out/Applications/KDE/heaptrack_gui.app/Contents/MacOS/heaptrack_gui \
71 $out/bin/heaptrack_gui
72 '';
73
74 meta = with lib; {
75 description = "Heap memory profiler for Linux";
76 homepage = "https://github.com/KDE/heaptrack";
77 license = licenses.lgpl21Plus;
78 mainProgram = "heaptrack_gui";
79 maintainers = with maintainers; [ ];
80 platforms = platforms.unix;
81 };
82}