1{
2 lib,
3 addDriverRunpath,
4 autoconf,
5 automake,
6 bison,
7 cmake,
8 fetchFromGitHub,
9 libXdmcp,
10 libglvnd,
11 libpthreadstubs,
12 makeWrapper,
13 nix-update-script,
14 pcre,
15 pkg-config,
16 # python3Packages.shiboken2 is currently broken
17 python312Packages,
18 qt5,
19 stdenv,
20 vulkan-loader,
21 wayland,
22 # Boolean flags
23 waylandSupport ? true,
24}:
25
26let
27 custom_swig = fetchFromGitHub {
28 owner = "baldurk";
29 repo = "swig";
30 rev = "renderdoc-modified-7";
31 hash = "sha256-RsdvxBBQvwuE5wSwL8OBXg5KMSpcO6EuMS0CzWapIpc=";
32 };
33in
34stdenv.mkDerivation (finalAttrs: {
35 pname = "renderdoc";
36 version = "1.39";
37
38 src = fetchFromGitHub {
39 owner = "baldurk";
40 repo = "renderdoc";
41 rev = "v${finalAttrs.version}";
42 hash = "sha256-UFaZtSA3oYOYKuV2loh5tX1rLnoKgRypaJe6H+j/uHU=";
43 };
44
45 outputs = [
46 "out"
47 "dev"
48 "doc"
49 ];
50
51 buildInputs = [
52 libXdmcp
53 libpthreadstubs
54 python312Packages.pyside2
55 python312Packages.pyside2-tools
56 python312Packages.shiboken2
57 qt5.qtbase
58 qt5.qtsvg
59 vulkan-loader
60 ]
61 ++ lib.optionals waylandSupport [
62 wayland
63 ];
64
65 nativeBuildInputs = [
66 addDriverRunpath
67 autoconf
68 automake
69 bison
70 cmake
71 makeWrapper
72 pcre
73 pkg-config
74 python312Packages.python
75 qt5.qtx11extras
76 qt5.wrapQtAppsHook
77 ];
78
79 cmakeFlags = [
80 (lib.cmakeFeature "BUILD_VERSION_HASH" finalAttrs.src.rev)
81 (lib.cmakeFeature "BUILD_VERSION_DIST_NAME" "NixOS")
82 (lib.cmakeFeature "BUILD_VERSION_DIST_VER" finalAttrs.version)
83 (lib.cmakeFeature "BUILD_VERSION_DIST_CONTACT" "https://github.com/NixOS/nixpkgs/")
84 (lib.cmakeBool "BUILD_VERSION_STABLE" true)
85 (lib.cmakeBool "ENABLE_UNSUPPORTED_EXPERIMENTAL_POSSIBLY_BROKEN_WAYLAND" waylandSupport)
86 ];
87
88 dontWrapQtApps = true;
89
90 strictDeps = true;
91
92 postUnpack = ''
93 cp -r ${custom_swig} swig
94 chmod -R +w swig
95 patchShebangs swig/autogen.sh
96 '';
97
98 # TODO: define these in the above array via placeholders, once those are
99 # widely supported
100 preConfigure = ''
101 cmakeFlagsArray+=(
102 "-DRENDERDOC_SWIG_PACKAGE=$PWD/../swig"
103 "-DVULKAN_LAYER_FOLDER=$out/share/vulkan/implicit_layer.d/"
104 )
105 '';
106
107 preFixup =
108 let
109 libPath = lib.makeLibraryPath [
110 libglvnd
111 vulkan-loader
112 ];
113 in
114 ''
115 wrapQtApp $out/bin/qrenderdoc \
116 --set QT_QPA_PLATFORM "wayland;xcb" \
117 --suffix LD_LIBRARY_PATH : "$out/lib:${libPath}"
118 wrapProgram $out/bin/renderdoccmd \
119 --suffix LD_LIBRARY_PATH : "$out/lib:${libPath}"
120 '';
121
122 # The only documentation for this so far is in the setup-hook.sh script from
123 # add-opengl-runpath
124 postFixup = ''
125 addDriverRunpath $out/lib/librenderdoc.so
126 '';
127
128 passthru.updateScript = nix-update-script { };
129
130 meta = {
131 homepage = "https://renderdoc.org/";
132 description = "Single-frame graphics debugger";
133 longDescription = ''
134 RenderDoc is a free MIT licensed stand-alone graphics debugger that
135 allows quick and easy single-frame capture and detailed introspection
136 of any application using Vulkan, D3D11, OpenGL or D3D12 across
137 Windows 7 - 10, Linux or Android.
138 '';
139 license = lib.licenses.mit;
140 mainProgram = "renderdoccmd";
141 maintainers = with lib.maintainers; [
142 pbsds
143 ShyAssassin
144 ];
145 platforms = lib.intersectLists lib.platforms.linux (lib.platforms.x86_64 ++ lib.platforms.i686);
146 };
147})