Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 zlib
51 boost
52 libunwind
53 sparsehash
54 zstd
55 qtbase
56 kio
57 kitemmodels
58 threadweaver
59 kconfigwidgets
60 kcoreaddons
61 kdiagram
62 ]
63 ++ lib.optionals stdenv.hostPlatform.isLinux [
64 elfutils
65 ];
66
67 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
68 makeWrapper \
69 $out/Applications/KDE/heaptrack_gui.app/Contents/MacOS/heaptrack_gui \
70 $out/bin/heaptrack_gui
71 '';
72
73 meta = with lib; {
74 description = "Heap memory profiler for Linux";
75 homepage = "https://github.com/KDE/heaptrack";
76 license = licenses.lgpl21Plus;
77 mainProgram = "heaptrack_gui";
78 maintainers = with maintainers; [ ];
79 platforms = platforms.unix;
80 };
81}