1{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libxcb
2, libXrandr, wayland, moltenvk, vulkan-headers, addOpenGLRunpath
3, testers }:
4
5stdenv.mkDerivation (finalAttrs: {
6 pname = "vulkan-loader";
7 version = "1.3.283.0";
8
9 src = fetchFromGitHub {
10 owner = "KhronosGroup";
11 repo = "Vulkan-Loader";
12 rev = "vulkan-sdk-${finalAttrs.version}";
13 hash = "sha256-pe4WYbfB20yRI5Pg+RxgmQcmdXsSoRxbBkQ3DdAL8r4=";
14 };
15
16 patches = [ ./fix-pkgconfig.patch ];
17
18 nativeBuildInputs = [ cmake pkg-config ];
19 buildInputs = [ vulkan-headers ]
20 ++ lib.optionals stdenv.isLinux [ libX11 libxcb libXrandr wayland ];
21
22 cmakeFlags = [ "-DCMAKE_INSTALL_INCLUDEDIR=${vulkan-headers}/include" ]
23 ++ lib.optional stdenv.isDarwin "-DSYSCONFDIR=${moltenvk}/share"
24 ++ lib.optional stdenv.isLinux "-DSYSCONFDIR=${addOpenGLRunpath.driverLink}/share"
25 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DUSE_GAS=OFF";
26
27 outputs = [ "out" "dev" ];
28
29 doInstallCheck = true;
30
31 installCheckPhase = ''
32 grep -q "${vulkan-headers}/include" $dev/lib/pkgconfig/vulkan.pc || {
33 echo vulkan-headers include directory not found in pkg-config file
34 exit 1
35 }
36 '';
37
38 passthru = {
39 tests.pkg-config = testers.hasPkgConfigModules {
40 package = finalAttrs.finalPackage;
41 };
42 };
43
44 meta = with lib; {
45 description = "LunarG Vulkan loader";
46 homepage = "https://www.lunarg.com";
47 platforms = platforms.unix ++ platforms.windows;
48 license = licenses.asl20;
49 maintainers = [ maintainers.ralith ];
50 broken = finalAttrs.version != vulkan-headers.version;
51 pkgConfigModules = [ "vulkan" ];
52 };
53})