nixpkgs/pkgs/by-name/vu/vulkan-validation-layers/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

89 lines
1.8 KiB
Nix

{ lib
, callPackage
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, jq
, glslang
, libffi
, libX11
, libXau
, libxcb
, libXdmcp
, libXrandr
, spirv-headers
, spirv-tools
, vulkan-headers
, vulkan-utility-libraries
, wayland
}:
let
robin-hood-hashing = callPackage ./robin-hood-hashing.nix {};
in
stdenv.mkDerivation rec {
pname = "vulkan-validation-layers";
version = "1.3.296.0";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-ValidationLayers";
rev = "vulkan-sdk-${version}";
hash = "sha256-H5AG+PXM3IdCfDqHMdaunRUWRm8QgdS6ZbZLMaOOALk=";
};
strictDeps = true;
nativeBuildInputs = [
cmake
pkg-config
jq
];
buildInputs = [
glslang
libX11
libXau
libXdmcp
libXrandr
libffi
libxcb
robin-hood-hashing
spirv-headers
spirv-tools
vulkan-headers
vulkan-utility-libraries
wayland
];
cmakeFlags = [
"-DBUILD_LAYER_SUPPORT_FILES=ON"
# Hide dev warnings that are useless for packaging
"-Wno-dev"
];
# Tests require access to vulkan-compatible GPU, which isn't
# available in Nix sandbox. Fails with VK_ERROR_INCOMPATIBLE_DRIVER.
doCheck = false;
separateDebugInfo = true;
# Include absolute paths to layer libraries in their associated
# layer definition json files.
preFixup = ''
for f in "$out"/share/vulkan/explicit_layer.d/*.json "$out"/share/vulkan/implicit_layer.d/*.json; do
jq <"$f" >tmp.json ".layer.library_path = \"$out/lib/\" + .layer.library_path"
mv tmp.json "$f"
done
'';
meta = with lib; {
description = "Official Khronos Vulkan validation layers";
homepage = "https://github.com/KhronosGroup/Vulkan-ValidationLayers";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = [ maintainers.ralith ];
};
}