nixpkgs-suyu/pkgs/development/tools/vulkan-validation-layers/default.nix
Anthony Cowley 6492af66e1 vulkan-validation-layers: 1.1.82.0 -> 1.1.85.0
This requires knock-on upgrades for glslang and spirv-tools.

I have also made the validation layers easier to use:
- library files identified by layer definitions now use absolute paths
- the layer definition path is prepended to XDG_DATA_DIRS

Previously, one would have to modify LD_LIBRARY_PATH or install the
derivation in a known location for vulkan-loader to find relevant
files. These changes make using validation layers in a nix-shell work automatically.

Use XDG_DATA_DIRS environment variable rather than VK_LAYER_PATH
2018-12-08 00:51:39 -05:00

40 lines
1.3 KiB
Nix

{ stdenv, fetchFromGitHub, cmake, writeText, python3
, vulkan-headers, vulkan-loader, glslang
, pkgconfig, xlibsWrapper, libxcb, libXrandr, wayland }:
stdenv.mkDerivation rec {
name = "vulkan-validation-layers-${version}";
version = "1.1.85.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-ValidationLayers";
rev = "sdk-${version}";
sha256 = "1y5ny587h62139fxnz760hsyv1dmw29m1a9vq096sn8qafh3jzbz";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake python3 vulkan-headers vulkan-loader xlibsWrapper libxcb libXrandr wayland ];
enableParallelBuilding = true;
cmakeFlags = [ "-DGLSLANG_INSTALL_DIR=${glslang}" ];
# Help vulkan-loader find the validation layers
setupHook = writeText "setup-hook" ''
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS
'';
# Include absolute paths to layer libraries in their associated
# layer definition json files.
patchPhase = ''
sed "s|\([[:space:]]*set(INSTALL_DEFINES \''${INSTALL_DEFINES} -DRELATIVE_LAYER_BINARY=\"\)\(\$<TARGET_FILE_NAME:\''${TARGET_NAME}>\")\)|\1$out/lib/\2|" -i layers/CMakeLists.txt
'';
meta = with stdenv.lib; {
description = "LunarG Vulkan loader";
homepage = https://www.lunarg.com;
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}