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