at 23.05-pre 111 lines 3.1 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, pkg-config 6, glslang 7, libffi 8, libX11 9, libXau 10, libxcb 11, libXdmcp 12, libXrandr 13, vulkan-headers 14, vulkan-loader 15, wayland 16, wayland-protocols 17, moltenvk 18, AppKit 19, Cocoa 20}: 21 22stdenv.mkDerivation rec { 23 pname = "vulkan-tools"; 24 version = "1.3.231.0"; 25 26 # It's not strictly necessary to have matching versions here, however 27 # since we're using the SDK version we may as well be consistent with 28 # the rest of nixpkgs. 29 src = (assert (version) == vulkan-headers.version; 30 fetchFromGitHub { 31 owner = "KhronosGroup"; 32 repo = "Vulkan-Tools"; 33 rev = "sdk-${version}"; 34 hash = "sha256-6oimP4ISa0dX4bLU3Nch8Ur6MzEMQscnL8EfRrqT/Es="; 35 }); 36 37 nativeBuildInputs = [ 38 cmake 39 pkg-config 40 ]; 41 42 buildInputs = [ 43 glslang 44 vulkan-headers 45 vulkan-loader 46 ] ++ lib.optionals (!stdenv.isDarwin) [ 47 libffi 48 libX11 49 libXau 50 libxcb 51 libXdmcp 52 libXrandr 53 wayland 54 wayland-protocols 55 ] ++ lib.optionals stdenv.isDarwin [ 56 moltenvk 57 moltenvk.dev 58 AppKit 59 Cocoa 60 ]; 61 62 libraryPath = lib.strings.makeLibraryPath [ vulkan-loader ]; 63 64 patches = [ 65 # Vulkan-Tools expects to find the MoltenVK ICD and `libMoltenVK.dylib` in its source repo. 66 # Patch it to use the already-built binaries and ICD in nixpkgs. 67 ./use-nix-moltenvk.patch 68 ]; 69 70 # vkcube.app and vkcubepp.app require `ibtool`, but the version in `xib2nib` is not capable of 71 # building these apps. Build them using `ibtool` from Xcode, but don’t allow any other binaries 72 # into the sandbox. Note that the CLT are not supported because `ibtool` requires Xcode. 73 sandboxProfile = lib.optionalString stdenv.isDarwin '' 74 (allow process-exec 75 (literal "/usr/bin/ibtool") 76 (regex "/Xcode.app/Contents/Developer/usr/bin/ibtool") 77 (regex "/Xcode.app/Contents/Developer/usr/bin/xcodebuild")) 78 (allow file-read*) 79 (deny file-read* (subpath "/usr/local") (with no-log)) 80 (allow file-write* (subpath "/private/var/folders")) 81 ''; 82 83 dontPatchELF = true; 84 85 cmakeFlags = [ 86 # Don't build the mock ICD as it may get used instead of other drivers, if installed 87 "-DBUILD_ICD=OFF" 88 # vulkaninfo loads libvulkan using dlopen, so we have to add it manually to RPATH 89 "-DCMAKE_INSTALL_RPATH=${libraryPath}" 90 "-DPKG_CONFIG_EXECUTABLE=${pkg-config}/bin/pkg-config" 91 # Hide dev warnings that are useless for packaging 92 "-Wno-dev" 93 ] ++ lib.optionals stdenv.isDarwin [ 94 "-DMOLTENVK_REPO_ROOT=${moltenvk}/share/vulkan/icd.d" 95 "-DIBTOOL=/usr/bin/ibtool" 96 ]; 97 98 meta = with lib; { 99 description = "Khronos official Vulkan Tools and Utilities"; 100 longDescription = '' 101 This project provides Vulkan tools and utilities that can assist 102 development by enabling developers to verify their applications correct 103 use of the Vulkan API. 104 ''; 105 homepage = "https://github.com/KhronosGroup/Vulkan-Tools"; 106 hydraPlatforms = [ "x86_64-linux" "i686-linux" ]; 107 platforms = platforms.unix; 108 license = licenses.asl20; 109 maintainers = [ maintainers.ralith ]; 110 }; 111}