about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/vulkan-tools-lunarg/default.nix
blob: ab593a9bc4de7da3908a2a35df238aa2c3c9cf91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib
, stdenv
, fetchFromGitHub
, cmake
, python3
, jq
, expat
, jsoncpp
, libX11
, libXdmcp
, libXrandr
, libffi
, libxcb
, pkg-config
, wayland
, which
, xcbutilkeysyms
, xcbutilwm
, valijson
, vulkan-headers
, vulkan-loader
, vulkan-utility-libraries
, writeText
}:

stdenv.mkDerivation rec {
  pname = "vulkan-tools-lunarg";
  version = "1.3.268.0";

  src = fetchFromGitHub {
   owner = "LunarG";
   repo = "VulkanTools";
   rev = "vulkan-sdk-${version}";
   hash = "sha256-2ZUD+RBsl35QV3250JOPCIoJb4sJcBsiRE4SZaS6ROs=";
 };

  nativeBuildInputs = [ cmake python3 jq which pkg-config ];

  buildInputs = [
    expat
    jsoncpp
    libX11
    libXdmcp
    libXrandr
    libffi
    libxcb
    valijson
    vulkan-headers
    vulkan-loader
    vulkan-utility-libraries
    wayland
    xcbutilkeysyms
    xcbutilwm
  ];

  cmakeFlags = [
    "-DVULKAN_HEADERS_INSTALL_DIR=${vulkan-headers}"
  ];

  preConfigure = ''
    patchShebangs scripts/*
    substituteInPlace via/CMakeLists.txt --replace "jsoncpp_static" "jsoncpp"
  '';

  # Include absolute paths to layer libraries in their associated
  # layer definition json files.
  preFixup = ''
    for f in "$out"/etc/vulkan/explicit_layer.d/*.json "$out"/etc/vulkan/implicit_layer.d/*.json; do
      jq <"$f" >tmp.json ".layer.library_path = \"$out/lib/\" + .layer.library_path"
      mv tmp.json "$f"
    done
  '';

  # Help vulkan-loader find the validation layers
  setupHook = writeText "setup-hook" ''
    export XDG_CONFIG_DIRS=@out@/etc''${XDG_CONFIG_DIRS:+:''${XDG_CONFIG_DIRS}}
  '';

  meta = with lib; {
    description = "LunarG Vulkan Tools and Utilities";
    longDescription = ''
      Tools to aid in Vulkan development including useful layers, trace and
      replay, and tests.
    '';
    homepage = "https://github.com/LunarG/VulkanTools";
    platforms = platforms.linux;
    license = licenses.asl20;
    maintainers = [ maintainers.expipiplus1 ];
  };
}