nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPackages,
6 cmake,
7 pkg-config,
8 python3,
9 glslang,
10 libffi,
11 libX11,
12 libXau,
13 libxcb,
14 libXdmcp,
15 libXrandr,
16 vulkan-headers,
17 vulkan-loader,
18 vulkan-volk,
19 wayland,
20 wayland-protocols,
21 wayland-scanner,
22 moltenvk,
23}:
24
25stdenv.mkDerivation rec {
26 pname = "vulkan-tools";
27 version = "1.4.335";
28
29 src = fetchFromGitHub {
30 owner = "KhronosGroup";
31 repo = "Vulkan-Tools";
32 rev = "vulkan-sdk-${version}";
33 hash = "sha256-C/wzLLiG7DrLyP3YRKhjawNoEOCCogXkrFeBczeVZR0=";
34 };
35
36 patches = [ ./wayland-scanner.patch ];
37
38 nativeBuildInputs = [
39 cmake
40 pkg-config
41 python3
42 wayland-scanner
43 ];
44
45 buildInputs = [
46 glslang
47 vulkan-headers
48 vulkan-loader
49 vulkan-volk
50 ]
51 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
52 libffi
53 libX11
54 libXau
55 libxcb
56 libXdmcp
57 libXrandr
58 wayland
59 wayland-protocols
60 ]
61 ++ lib.optionals stdenv.hostPlatform.isDarwin [
62 moltenvk
63 moltenvk.dev
64 ];
65
66 libraryPath = lib.strings.makeLibraryPath [ vulkan-loader ];
67
68 dontPatchELF = true;
69
70 env.PKG_CONFIG_PATH = "${lib.getDev buildPackages.wayland-scanner}/lib/pkgconfig";
71
72 cmakeFlags = [
73 # Don't build the mock ICD as it may get used instead of other drivers, if installed
74 "-DBUILD_ICD=OFF"
75 # vulkaninfo loads libvulkan using dlopen, so we have to add it manually to RPATH
76 "-DCMAKE_INSTALL_RPATH=${libraryPath}"
77 "-DGLSLANG_INSTALL_DIR=${glslang}"
78 # Hide dev warnings that are useless for packaging
79 "-Wno-dev"
80 ]
81 ++ lib.optionals stdenv.hostPlatform.isDarwin [
82 "-DMOLTENVK_REPO_ROOT=${moltenvk}/share/vulkan/icd.d"
83 # Don’t build the cube demo because it requires `ibtool`, which is not available in nixpkgs.
84 "-DBUILD_CUBE=OFF"
85 ];
86
87 meta = {
88 description = "Khronos official Vulkan Tools and Utilities";
89 longDescription = ''
90 This project provides Vulkan tools and utilities that can assist
91 development by enabling developers to verify their applications correct
92 use of the Vulkan API.
93 '';
94 homepage = "https://github.com/KhronosGroup/Vulkan-Tools";
95 platforms = lib.platforms.unix;
96 license = lib.licenses.asl20;
97 maintainers = [ lib.maintainers.ralith ];
98 };
99}