1 { lib, stdenv, fetchFromGitHub, cmake, pkg-config, libX11, libxcb
2 , libXrandr, wayland, moltenvk, vulkan-headers, addOpenGLRunpath }:
4 stdenv.mkDerivation rec {
5 pname = "vulkan-loader";
8 src = (assert version == vulkan-headers.version;
10 owner = "KhronosGroup";
11 repo = "Vulkan-Loader";
12 rev = "sdk-${version}";
13 hash = "sha256-HWaa3JT0znhvqbvZdcsAwy8Dr6HDQp4rgpVmMOuCo0s=";
16 patches = [ ./fix-pkgconfig.patch ];
18 nativeBuildInputs = [ cmake pkg-config ];
19 buildInputs = [ vulkan-headers ]
20 ++ lib.optionals (!stdenv.isDarwin) [ libX11 libxcb libXrandr wayland ];
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";
27 outputs = [ "out" "dev" ];
29 doInstallCheck = true;
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
39 description = "LunarG Vulkan loader";
40 homepage = "https://www.lunarg.com";
41 platforms = platforms.unix;
42 license = licenses.asl20;
43 maintainers = [ maintainers.ralith ];