1{ lib
2, stdenv
3, fetchFromGitHub
4, glslang
5, meson
6, ninja
7, pkg-config
8, libX11
9, spirv-headers
10, vulkan-headers
11, vkbasalt32
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "vkbasalt";
16 version = "0.3.2.9";
17
18 src = fetchFromGitHub {
19 owner = "DadSchoorse";
20 repo = "vkBasalt";
21 rev = "refs/tags/v${finalAttrs.version}";
22 hash = "sha256-IVlZ6o+1EEEh547rFPN7z+W+EY7MrIM/yUh6+PPkNeI=";
23 };
24
25 nativeBuildInputs = [ glslang meson ninja pkg-config ];
26 buildInputs = [ libX11 spirv-headers vulkan-headers ];
27 mesonFlags = [ "-Dappend_libdir_vkbasalt=true" ];
28
29 postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
30 install -Dm 644 $src/config/vkBasalt.conf $out/share/vkBasalt/vkBasalt.conf
31 # Include 32bit layer in 64bit build
32 ln -s ${vkbasalt32}/share/vulkan/implicit_layer.d/vkBasalt.json \
33 "$out/share/vulkan/implicit_layer.d/vkBasalt32.json"
34 '';
35
36 # We need to give the different layers separate names or else the loader
37 # might try the 32-bit one first, fail and not attempt to load the 64-bit
38 # layer under the same name.
39 postFixup = ''
40 substituteInPlace "$out/share/vulkan/implicit_layer.d/vkBasalt.json" \
41 --replace "VK_LAYER_VKBASALT_post_processing" "VK_LAYER_VKBASALT_post_processing_${toString stdenv.hostPlatform.parsed.cpu.bits}"
42 '';
43
44 meta = with lib; {
45 description = "A Vulkan post processing layer for Linux";
46 homepage = "https://github.com/DadSchoorse/vkBasalt";
47 license = licenses.zlib;
48 maintainers = with maintainers; [ kira-bruneau ];
49 platforms = platforms.linux;
50 };
51})