Skip to content

Commit

Permalink
tracy: split the package into tracy-wayland and tracy-glfw.
Browse files Browse the repository at this point in the history
  • Loading branch information
paveloom committed Jul 18, 2024
1 parent 60d532e commit 646f531
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 132 deletions.
6 changes: 3 additions & 3 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@

- `/share/vim-plugins` now only gets linked if `programs.vim.enable` is enabled

- The `tracy` package no longer works on X11, since it's moved to Wayland
support, which is the intended default behavior by Tracy maintainers.
X11 users have to switch to the new package `tracy-x11`.
- The profiler from the `tracy` package no longer works on X11, since it
requires Wayland now, which is the intended default behavior by Tracy
maintainers. X11 users have to switch to the new package `tracy-glfw`.

- The `services.prometheus.exporters.minio` option has been removed, as it's upstream implementation was broken and unmaintained.
Minio now has built-in [Prometheus metrics exposure](https://min.io/docs/minio/linux/operations/monitoring/collect-minio-metrics-using-prometheus.html), which can be used instead.
Expand Down
132 changes: 132 additions & 0 deletions pkgs/by-name/tr/tracy/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
lib,
stdenv,
fetchFromGitHub,

cmake,
ninja,

capstone,
darwin,
dbus,
freetype,
glfw,
pkg-config,
tbb,

withWayland ? stdenv.isLinux,
libglvnd,
libxkbcommon,
wayland-protocols,
wayland,
}:

stdenv.mkDerivation rec {
pname = if (stdenv.isLinux && withWayland) then "tracy-wayland" else "tracy-glfw";
version = "0.11.0";

src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
sha256 = "sha256-wGKnmCpmG70Xx/+RfZhXTLSY38AcGrZK/jxPpePkXik=";
};

patches = lib.optional (
stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11"
) ./dont-use-the-uniformtypeidentifiers-framework.patch;

nativeBuildInputs = [
cmake
ninja
pkg-config
] ++ lib.optionals stdenv.cc.isClang [ stdenv.cc.cc.libllvm ];

buildInputs =
[
capstone
dbus
freetype
tbb
]
++ lib.optionals (stdenv.isLinux && withWayland) [
libglvnd
libxkbcommon
wayland
wayland-protocols
]
++ lib.optionals (stdenv.isDarwin || (stdenv.isLinux && !withWayland)) [ glfw ]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]
++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
darwin.apple_sdk.frameworks.UniformTypeIdentifiers
];

cmakeFlags = [
"-DDOWNLOAD_CAPSTONE=off"
"-DTRACY_STATIC=off"
] ++ lib.optional (stdenv.isLinux && !withWayland) "-DLEGACY=on";

env.NIX_CFLAGS_COMPILE = toString (
[ ]
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional (
stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13"
) "-fno-aligned-allocation"
# Workaround for https://github.com/NixOS/nixpkgs/issues/19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto"
);

dontUseCmakeBuildDir = true;

postConfigure = ''
cmake -B capture/build -S capture $cmakeFlags
cmake -B csvexport/build -S csvexport $cmakeFlags
cmake -B import-chrome/build -S import-chrome $cmakeFlags
cmake -B import-fuchsia/build -S import-fuchsia $cmakeFlags
cmake -B profiler/build -S profiler $cmakeFlags
cmake -B update/build -S update $cmakeFlags
'';

postBuild = ''
ninja -C capture/build
ninja -C csvexport/build
ninja -C import-chrome/build
ninja -C import-fuchsia/build
ninja -C profiler/build
ninja -C update/build
'';

postInstall =
''
install -D -m 0555 capture/build/tracy-capture -t $out/bin
install -D -m 0555 csvexport/build/tracy-csvexport $out/bin
install -D -m 0555 import-chrome/build/tracy-import-chrome -t $out/bin
install -D -m 0555 import-fuchsia/build/tracy-import-fuchsia -t $out/bin
install -D -m 0555 profiler/build/tracy-profiler $out/bin/tracy
install -D -m 0555 update/build/tracy-update -t $out/bin
''
+ lib.optionalString stdenv.isLinux ''
substituteInPlace extra/desktop/tracy.desktop \
--replace Exec=/usr/bin/tracy Exec=tracy
install -D -m 0444 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
install -D -m 0444 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
install -D -m 0444 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
install -D -m 0444 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
install -D -m 0444 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
'';

meta = with lib; {
description = "Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
homepage = "https://github.com/wolfpld/tracy";
license = licenses.bsd3;
mainProgram = "tracy";
maintainers = with maintainers; [
mpickering
nagisa
paveloom
];
platforms =
if (stdenv.isLinux && withWayland) then platforms.linux else platforms.linux ++ platforms.darwin;
};
}
131 changes: 3 additions & 128 deletions pkgs/by-name/tr/tracy/package.nix
Original file line number Diff line number Diff line change
@@ -1,132 +1,7 @@
{
lib,
stdenv,
fetchFromGitHub,

cmake,
ninja,

capstone,
darwin,
dbus,
freetype,
glfw,
hicolor-icon-theme,
pkg-config,
tbb,

withWayland ? stdenv.isLinux,
libglvnd,
libxkbcommon,
wayland-protocols,
wayland,
tracy-glfw,
tracy-wayland,
}:

stdenv.mkDerivation rec {
pname = "tracy";
version = "0.11.0";

src = fetchFromGitHub {
owner = "wolfpld";
repo = "tracy";
rev = "v${version}";
sha256 = "sha256-wGKnmCpmG70Xx/+RfZhXTLSY38AcGrZK/jxPpePkXik=";
};

patches = lib.optional (
stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "11"
) ./dont-use-the-uniformtypeidentifiers-framework.patch;

nativeBuildInputs = [
cmake
ninja
pkg-config
] ++ lib.optionals stdenv.cc.isClang [ stdenv.cc.cc.libllvm ];

buildInputs =
[
capstone
dbus
freetype
tbb
]
++ lib.optionals (stdenv.isLinux && withWayland) [
libglvnd
libxkbcommon
wayland
wayland-protocols
]
++ lib.optionals (stdenv.isDarwin || (stdenv.isLinux && !withWayland)) [ glfw ]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]
++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") [
darwin.apple_sdk.frameworks.UniformTypeIdentifiers
];

cmakeFlags = [
"-DDOWNLOAD_CAPSTONE=off"
"-DTRACY_STATIC=off"
] ++ lib.optional (stdenv.isLinux && !withWayland) "-DLEGACY=on";

env.NIX_CFLAGS_COMPILE = toString (
[ ]
++ lib.optional stdenv.isLinux "-ltbb"
++ lib.optional (
stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13"
) "-fno-aligned-allocation"
# Workaround for https://github.com/NixOS/nixpkgs/issues/19098
++ lib.optional (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto"
);

dontUseCmakeBuildDir = true;

postConfigure = ''
cmake -B capture/build -S capture $cmakeFlags
cmake -B csvexport/build -S csvexport $cmakeFlags
cmake -B import-chrome/build -S import-chrome $cmakeFlags
cmake -B import-fuchsia/build -S import-fuchsia $cmakeFlags
cmake -B profiler/build -S profiler $cmakeFlags
cmake -B update/build -S update $cmakeFlags
'';

postBuild = ''
ninja -C capture/build
ninja -C csvexport/build
ninja -C import-chrome/build
ninja -C import-fuchsia/build
ninja -C profiler/build
ninja -C update/build
'';

postInstall =
''
install -D -m 0555 capture/build/tracy-capture -t $out/bin
install -D -m 0555 csvexport/build/tracy-csvexport $out/bin
install -D -m 0555 import-chrome/build/tracy-import-chrome -t $out/bin
install -D -m 0555 import-fuchsia/build/tracy-import-fuchsia -t $out/bin
install -D -m 0555 profiler/build/tracy-profiler $out/bin/tracy
install -D -m 0555 update/build/tracy-update -t $out/bin
''
+ lib.optionalString stdenv.isLinux ''
substituteInPlace extra/desktop/tracy.desktop \
--replace Exec=/usr/bin/tracy Exec=tracy
install -D -m 0444 extra/desktop/application-tracy.xml $out/share/mime/packages/application-tracy.xml
install -D -m 0444 extra/desktop/tracy.desktop $out/share/applications/tracy.desktop
install -D -m 0444 icon/application-tracy.svg $out/share/icons/hicolor/scalable/apps/application-tracy.svg
install -D -m 0444 icon/icon.png $out/share/icons/hicolor/256x256/apps/tracy.png
install -D -m 0444 icon/icon.svg $out/share/icons/hicolor/scalable/apps/tracy.svg
'';

meta = with lib; {
description = "Real time, nanosecond resolution, remote telemetry frame profiler for games and other applications";
homepage = "https://github.com/wolfpld/tracy";
license = licenses.bsd3;
mainProgram = "tracy";
maintainers = with maintainers; [
mpickering
nagisa
paveloom
];
platforms = platforms.linux ++ platforms.darwin;
};
}
if (stdenv.isLinux) then tracy-wayland else tracy-glfw
3 changes: 2 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7521,7 +7521,8 @@ with pkgs;

tracker = callPackage ../development/libraries/tracker { };

tracy-x11 = callPackage ../by-name/tr/tracy/package.nix { withWayland = false; };
tracy-glfw = callPackage ../by-name/tr/tracy/default.nix { withWayland = false; };
tracy-wayland = callPackage ../by-name/tr/tracy/default.nix { };

trivy = callPackage ../tools/admin/trivy { };

Expand Down

0 comments on commit 646f531

Please sign in to comment.