18 withGtkFileSelector ? false,
21 withWayland ? stdenv.hostPlatform.isLinux,
28 assert withGtkFileSelector -> stdenv.isLinux;
29 assert withWayland -> stdenv.isLinux;
31 stdenv.mkDerivation rec {
32 pname = if withWayland then "tracy-wayland" else "tracy-glfw";
35 src = fetchFromGitHub {
39 hash = "sha256-HofqYJT1srDJ6Y1f18h7xtAbI/Gvvz0t9f0wBNnOZK8=";
42 patches = lib.optional (
43 stdenv.hostPlatform.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11"
44 ) ./dont-use-the-uniformtypeidentifiers-framework.patch;
52 ++ lib.optionals stdenv.isLinux [ wayland-scanner ]
53 ++ lib.optionals stdenv.cc.isClang [ stdenv.cc.cc.libllvm ];
61 ++ lib.optionals (stdenv.hostPlatform.isLinux && withGtkFileSelector) [ gtk3 ]
62 ++ lib.optionals (stdenv.hostPlatform.isLinux && !withGtkFileSelector) [ dbus ]
63 ++ lib.optionals (stdenv.hostPlatform.isLinux && withWayland) [
69 ++ lib.optionals (stdenv.hostPlatform.isDarwin || (stdenv.hostPlatform.isLinux && !withWayland)) [
72 ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]
74 stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11"
75 ) [ darwin.apple_sdk.frameworks.UniformTypeIdentifiers ];
79 "-DDOWNLOAD_CAPSTONE=off"
82 ++ lib.optional (stdenv.isLinux && withGtkFileSelector) "-DGTK_FILESELECTOR=ON"
83 ++ lib.optional (stdenv.isLinux && !withWayland) "-DLEGACY=on";
85 env.NIX_CFLAGS_COMPILE = toString (
87 ++ lib.optional stdenv.hostPlatform.isLinux "-ltbb"
88 # Workaround for https://github.com/NixOS/nixpkgs/issues/19098
89 ++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform.isDarwin) "-fno-lto"
92 dontUseCmakeBuildDir = true;
95 cmake -B capture/build -S capture $cmakeFlags
96 cmake -B csvexport/build -S csvexport $cmakeFlags
97 cmake -B import/build -S import $cmakeFlags
98 cmake -B profiler/build -S profiler $cmakeFlags
99 cmake -B update/build -S update $cmakeFlags
103 ninja -C capture/build
104 ninja -C csvexport/build
105 ninja -C import/build
106 ninja -C profiler/build
107 ninja -C update/build
112 install -D -m 0555 capture/build/tracy-capture -t $out/bin
113 install -D -m 0555 csvexport/build/tracy-csvexport $out/bin
114 install -D -m 0555 import/build/{tracy-import-chrome,tracy-import-fuchsia} -t $out/bin
115 install -D -m 0555 profiler/build/tracy-profiler $out/bin/tracy
116 install -D -m 0555 update/build/tracy-update -t $out/bin
118 + lib.optionalString stdenv.hostPlatform.isLinux ''
119 substituteInPlace extra/desktop/tracy.desktop \
120 --replace-fail Exec=/usr/bin/tracy Exec=tracy
122 install -D -m 0444 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
123 install -D -m 0444 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
124 install -D -m 0444 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
125 install -D -m 0444 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
126 install -D -m 0444 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
130 description = "Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
131 homepage = "https://github.com/wolfpld/tracy";
132 license = licenses.bsd3;
133 mainProgram = "tracy";
134 maintainers = with maintainers; [
139 platforms = platforms.linux ++ platforms.darwin;