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