1{ lib
2, fetchFromGitHub
3, nix-update-script
4, cmake
5, pkg-config
6, mkDerivation
7, qtbase
8, qtx11extras
9, qtsvg
10, makeWrapper
11, vulkan-loader
12, libglvnd
13, xorg
14, python3
15, python3Packages
16, bison
17, pcre
18, automake
19, autoconf
20, addOpenGLRunpath
21, waylandSupport ? false
22, wayland
23}:
24let
25 custom_swig = fetchFromGitHub {
26 owner = "baldurk";
27 repo = "swig";
28 rev = "renderdoc-modified-7";
29 sha256 = "15r2m5kcs0id64pa2fsw58qll3jyh71jzc04wy20pgsh2326zis6";
30 };
31 cmakeBool = b: if b then "ON" else "OFF";
32in
33mkDerivation rec {
34 pname = "renderdoc";
35 version = "1.26";
36
37 src = fetchFromGitHub {
38 owner = "baldurk";
39 repo = "renderdoc";
40 rev = "v${version}";
41 sha256 = "sha256-z3qHW7hVde51TkRZO3Ld8DbUODa2Gbnh3zosW2O8eOQ=";
42 };
43
44 buildInputs = [
45 qtbase qtsvg xorg.libpthreadstubs xorg.libXdmcp qtx11extras vulkan-loader python3
46 ] ++ (with python3Packages; [
47 pyside2 pyside2-tools shiboken2
48 ])
49 ++ lib.optional waylandSupport wayland;
50
51 nativeBuildInputs = [ cmake makeWrapper pkg-config bison pcre automake autoconf addOpenGLRunpath ];
52
53 postUnpack = ''
54 cp -r ${custom_swig} swig
55 chmod -R +w swig
56 patchShebangs swig/autogen.sh
57 '';
58
59 cmakeFlags = [
60 "-DBUILD_VERSION_HASH=${src.rev}"
61 "-DBUILD_VERSION_DIST_NAME=NixOS"
62 "-DBUILD_VERSION_DIST_VER=${version}"
63 "-DBUILD_VERSION_DIST_CONTACT=https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/graphics/renderdoc"
64 "-DBUILD_VERSION_STABLE=ON"
65 "-DENABLE_WAYLAND=${cmakeBool waylandSupport}"
66 ];
67
68 # TODO: define these in the above array via placeholders, once those are widely supported
69 preConfigure = ''
70 cmakeFlags+=" -DVULKAN_LAYER_FOLDER=$out/share/vulkan/implicit_layer.d/"
71 cmakeFlags+=" -DRENDERDOC_SWIG_PACKAGE=$PWD/../swig"
72 '';
73
74 dontWrapQtApps = true;
75 preFixup = ''
76 wrapQtApp $out/bin/qrenderdoc --suffix LD_LIBRARY_PATH : "$out/lib:${vulkan-loader}/lib:${libglvnd}/lib"
77 wrapProgram $out/bin/renderdoccmd --suffix LD_LIBRARY_PATH : "$out/lib:${vulkan-loader}/lib:${libglvnd}/lib"
78 '';
79
80 # The only documentation for this so far is in pkgs/build-support/add-opengl-runpath/setup-hook.sh
81 postFixup = ''
82 addOpenGLRunpath $out/lib/librenderdoc.so
83 '';
84
85 passthru.updateScript = nix-update-script { };
86
87 meta = with lib; {
88 description = "A single-frame graphics debugger";
89 homepage = "https://renderdoc.org/";
90 license = licenses.mit;
91 longDescription = ''
92 RenderDoc is a free MIT licensed stand-alone graphics debugger that
93 allows quick and easy single-frame capture and detailed introspection
94 of any application using Vulkan, D3D11, OpenGL or D3D12 across
95 Windows 7 - 10, Linux or Android.
96 '';
97 maintainers = [ ];
98 platforms = [ "i686-linux" "x86_64-linux" ];
99 };
100}