15 stdenv.mkDerivation rec {
19 src = fetchFromGitHub {
23 sha256 = "sha256-DN1ExvQ5wcIUyhMAfiakFbZkDsx+5l8VMtYGvSdboPA=";
26 patches = lib.optionals (stdenv.isDarwin && !(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")) [
27 ./0001-remove-unifiedtypeidentifiers-framework
30 nativeBuildInputs = [ pkg-config ];
36 ] ++ lib.optionals stdenv.isLinux [
40 ] ++ lib.optionals stdenv.isDarwin [
41 darwin.apple_sdk.frameworks.AppKit
42 darwin.apple_sdk.frameworks.Carbon
43 ] ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
44 darwin.apple_sdk.frameworks.UniformTypeIdentifiers
47 env.NIX_CFLAGS_COMPILE = toString ([ ]
48 # Apple's compiler finds a format string security error on
49 # ../../../server/TracyView.cpp:649:34, preventing building.
50 ++ lib.optional stdenv.isDarwin "-Wno-format-security"
51 ++ lib.optional stdenv.isLinux "-ltbb"
52 ++ lib.optional stdenv.cc.isClang "-faligned-allocation"
53 # workaround issue #19098
54 ++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto");
59 make -j $NIX_BUILD_CORES -C capture/build/unix release
60 make -j $NIX_BUILD_CORES -C csvexport/build/unix release
61 make -j $NIX_BUILD_CORES -C import-chrome/build/unix release
62 make -j $NIX_BUILD_CORES -C library/unix release
63 make -j $NIX_BUILD_CORES -C profiler/build/unix release LEGACY=1
64 make -j $NIX_BUILD_CORES -C update/build/unix release
72 install -D -m 0755 capture/build/unix/capture-release $out/bin/capture
73 install -D -m 0755 csvexport/build/unix/csvexport-release $out/bin/tracy-csvexport
74 install -D -m 0755 import-chrome/build/unix/import-chrome-release $out/bin/import-chrome
75 install -D -m 0755 library/unix/libtracy-release.so $out/lib/libtracy.so
76 install -D -m 0755 profiler/build/unix/Tracy-release $out/bin/tracy
77 install -D -m 0755 update/build/unix/update-release $out/bin/update
79 mkdir -p $out/include/Tracy/client
80 mkdir -p $out/include/Tracy/common
81 mkdir -p $out/include/Tracy/tracy
83 cp -p public/client/*.{h,hpp} $out/include/Tracy/client
84 cp -p public/common/*.{h,hpp} $out/include/Tracy/common
85 cp -p public/tracy/*.{h,hpp} $out/include/Tracy/tracy
86 '' + lib.optionalString stdenv.isLinux ''
87 substituteInPlace extra/desktop/tracy.desktop \
88 --replace Exec=/usr/bin/tracy Exec=tracy
90 install -D -m 0644 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
91 install -D -m 0644 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
92 install -D -m 0644 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
93 install -D -m 0644 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
94 install -D -m 0644 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
99 postFixup = lib.optionalString stdenv.isDarwin ''
100 install_name_tool -change libcapstone.4.dylib ${capstone}/lib/libcapstone.4.dylib $out/bin/tracy
104 description = "A real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
105 homepage = "https://github.com/wolfpld/tracy";
106 platforms = platforms.linux ++ platforms.darwin;
107 license = licenses.bsd3;
108 mainProgram = "tracy";
109 maintainers = with maintainers; [ mpickering nagisa paveloom ];