nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 156 lines 3.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchurl, 6 runCommand, 7 cmake, 8 ffmpeg, 9 glslang, 10 libdrm, 11 libglvnd, 12 libffi, 13 libpng, 14 libX11, 15 libXau, 16 libXdmcp, 17 libxcb, 18 makeWrapper, 19 mesa, 20 ninja, 21 pkg-config, 22 python3, 23 spirv-headers, 24 vulkan-headers, 25 vulkan-loader, 26 vulkan-utility-libraries, 27 wayland, 28 wayland-protocols, 29 wayland-scanner, 30 zlib, 31}: 32let 33 renderdoc = fetchurl { 34 url = "https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h"; 35 hash = "sha256-57XwqlsbDq3GOhxiTAyn9a8TOqhX1qQnGw7z0L22ho4="; 36 }; 37 38 # The build system expects all these dependencies inside the external folder and 39 # does not search for system-wide installations. 40 # It also expects the version specified in the repository, which can be incompatible 41 # with the version in nixpkgs (e.g. for SPIRV-Headers), so we don't want to patch in our packages. 42 # The revisions are extracted from https://github.com/KhronosGroup/VK-GL-CTS/blob/main/external/fetch_sources.py#L290 43 # with the vk-cts-sources.py script. 44 sources = import ./sources.nix { inherit fetchurl fetchFromGitHub; }; 45 46 # Use pinned version from vulkan-video-samples 47 shaderc-src = fetchFromGitHub { 48 owner = "google"; 49 repo = "shaderc"; 50 tag = "v2024.4"; 51 hash = "sha256-DIpgHiYAZlCIQ/uCZ3qSucPUZ1j3tKg0VgZVun+1UnI="; 52 }; 53in 54stdenv.mkDerivation (finalAttrs: { 55 pname = "vulkan-cts"; 56 version = "1.4.5.0"; 57 58 src = fetchFromGitHub { 59 owner = "KhronosGroup"; 60 repo = "VK-GL-CTS"; 61 rev = "vulkan-cts-${finalAttrs.version}"; 62 hash = "sha256-cbXSelRPCCH52xczWaxqftbimHe4PyIKZqySQSFTHos="; 63 }; 64 65 prePatch = '' 66 mkdir -p external/renderdoc/src 67 68 cp -r ${renderdoc} external/renderdoc/src/renderdoc_app.h 69 70 ${sources.prePatch} 71 72 chmod u+w -R external 73 ''; 74 75 buildInputs = [ 76 ffmpeg 77 libdrm 78 libffi 79 libglvnd 80 libpng 81 libX11 82 libXau 83 libXdmcp 84 libxcb 85 vulkan-headers 86 vulkan-utility-libraries 87 wayland 88 wayland-protocols 89 zlib 90 ]; 91 92 nativeBuildInputs = [ 93 cmake 94 makeWrapper 95 ninja 96 pkg-config 97 python3 98 wayland-scanner 99 ]; 100 101 depsBuildBuild = [ 102 pkg-config 103 ]; 104 105 cmakeFlags = [ 106 # Fix cts cmake not coping with absolute install dirs 107 "-DCMAKE_INSTALL_BINDIR=bin" 108 "-DCMAKE_INSTALL_LIBDIR=lib" 109 "-DCMAKE_INSTALL_INCLUDEDIR=include" 110 111 "-DWAYLAND_SCANNER=wayland-scanner" 112 # For vulkan-validation-layers 113 "-DGLSLANG_INSTALL_DIR=${glslang}" 114 "-DSPIRV_HEADERS_INSTALL_DIR=${spirv-headers}" 115 "-DSELECTED_BUILD_TARGETS=deqp-vk" 116 (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SHADERC" "${shaderc-src}") 117 ]; 118 119 postInstall = '' 120 # Check that nothing was installed so far 121 ! test -e $out 122 123 mkdir -p $out/bin $out/archive-dir 124 cp -a external/vulkancts/modules/vulkan/deqp-vk $out/bin/ 125 cp -a external/vulkancts/modules/vulkan/vulkan $out/archive-dir/ 126 cp -a external/vulkancts/modules/vulkan/vk-default $out/ 127 ''; 128 129 postFixup = '' 130 patchelf --add-rpath "${vulkan-loader}/lib" --add-needed "libvulkan.so" $out/bin/deqp-vk 131 wrapProgram $out/bin/deqp-vk \ 132 --add-flags "--deqp-archive-dir=$out/archive-dir" 133 ''; 134 135 passthru.updateScript = ./update.sh; 136 passthru.tests.lavapipe = 137 runCommand "vulkan-cts-tests-lavapipe" 138 { 139 nativeBuildInputs = [ 140 finalAttrs.finalPackage 141 mesa.llvmpipeHook 142 ]; 143 } 144 '' 145 deqp-vk -n dEQP-VK.api.smoke.triangle 146 touch $out 147 ''; 148 149 meta = { 150 description = "Khronos Vulkan Conformance Tests"; 151 homepage = "https://github.com/KhronosGroup/VK-GL-CTS/blob/main/external/vulkancts/README.md"; 152 changelog = "https://github.com/KhronosGroup/VK-GL-CTS/releases/tag/vulkan-cts-${finalAttrs.version}"; 153 license = lib.licenses.asl20; 154 maintainers = with lib.maintainers; [ Flakebi ]; 155 }; 156})