Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 pkg-config, 7 libX11, 8 libxcb, 9 libXrandr, 10 wayland, 11 moltenvk, 12 vulkan-headers, 13 addDriverRunpath, 14 enableX11 ? stdenv.hostPlatform.isLinux, 15 testers, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "vulkan-loader"; 20 version = "1.4.313.0"; 21 22 src = fetchFromGitHub { 23 owner = "KhronosGroup"; 24 repo = "Vulkan-Loader"; 25 rev = "vulkan-sdk-${finalAttrs.version}"; 26 hash = "sha256-CeIjyW90Ri0MvhyFfYgss5Rjh5fHKhQf7CgBEcB/nPk="; 27 }; 28 29 patches = [ ./fix-pkgconfig.patch ]; 30 31 nativeBuildInputs = [ 32 cmake 33 pkg-config 34 ]; 35 buildInputs = [ 36 vulkan-headers 37 ] 38 ++ lib.optionals enableX11 [ 39 libX11 40 libxcb 41 libXrandr 42 ] 43 ++ lib.optionals stdenv.hostPlatform.isLinux [ 44 wayland 45 ]; 46 47 cmakeFlags = [ 48 "-DCMAKE_INSTALL_INCLUDEDIR=${vulkan-headers}/include" 49 (lib.cmakeBool "BUILD_WSI_XCB_SUPPORT" enableX11) 50 (lib.cmakeBool "BUILD_WSI_XLIB_SUPPORT" enableX11) 51 ] 52 ++ lib.optional stdenv.hostPlatform.isDarwin "-DSYSCONFDIR=${moltenvk}/share" 53 ++ lib.optional stdenv.hostPlatform.isLinux "-DSYSCONFDIR=${addDriverRunpath.driverLink}/share" 54 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DUSE_GAS=OFF"; 55 56 outputs = [ 57 "out" 58 "dev" 59 ]; 60 61 doInstallCheck = true; 62 63 installCheckPhase = '' 64 grep -q "${vulkan-headers}/include" $dev/lib/pkgconfig/vulkan.pc || { 65 echo vulkan-headers include directory not found in pkg-config file 66 exit 1 67 } 68 ''; 69 70 passthru = { 71 tests.pkg-config = testers.hasPkgConfigModules { 72 package = finalAttrs.finalPackage; 73 }; 74 }; 75 76 meta = with lib; { 77 description = "LunarG Vulkan loader"; 78 homepage = "https://www.lunarg.com"; 79 platforms = platforms.unix ++ platforms.windows; 80 license = licenses.asl20; 81 maintainers = [ maintainers.ralith ]; 82 broken = finalAttrs.version != vulkan-headers.version; 83 pkgConfigModules = [ "vulkan" ]; 84 }; 85})