From 04be1e4a9f62c6a595d999e7793e2eea295b00a0 Mon Sep 17 00:00:00 2001 From: K900 Date: Thu, 13 Apr 2023 11:34:44 +0300 Subject: [PATCH] mangohud: use vendored vulkan-headers to fix build This isn't great but what can you do. --- pkgs/tools/graphics/mangohud/default.nix | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/graphics/mangohud/default.nix b/pkgs/tools/graphics/mangohud/default.nix index 8bdf4938ed58..d4aaa79a7c76 100644 --- a/pkgs/tools/graphics/mangohud/default.nix +++ b/pkgs/tools/graphics/mangohud/default.nix @@ -13,7 +13,6 @@ , hwdata , libX11 , mangohud32 -, vulkan-headers , appstream , glslang , makeWrapper @@ -22,7 +21,6 @@ , ninja , pkg-config , unzip -, vulkan-loader , libXNVCtrl , wayland , glew @@ -69,6 +67,21 @@ let sha256 = "sha256-PDjyddV5KxKGORECWUMp6YsXc3kks0T5gxKrCZKbdL4="; }; }; + + # Derived from subprojects/vulkan-headers.wrap + vulkan-headers = rec { + version = "1.2.158"; + src = fetchFromGitHub { + owner = "KhronosGroup"; + repo = "Vulkan-Headers"; + rev = "v${version}"; + hash = "sha256-5uyk2nMwV1MjXoa3hK/WUeGLwpINJJEvY16kc5DEaks="; + }; + patch = fetchurl { + url = "https://wrapdb.mesonbuild.com/v2/vulkan-headers_${version}-2/get_patch"; + hash = "sha256-hgNYz15z9FjNHoj4w4EW0SOrQh1c4uQSnsOOrt2CDhc="; + }; + }; in stdenv.mkDerivation rec { pname = "mangohud"; version = "0.6.8"; @@ -88,8 +101,11 @@ in stdenv.mkDerivation rec { cd "$sourceRoot/subprojects" cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version} cp -R --no-preserve=mode,ownership ${spdlog.src} spdlog-${spdlog.version} + cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version} )''; + env.NIX_CFLAGS_COMPILE = "-I${vulkan-headers.src}/include"; + patches = [ # Hard code dependencies. Can't use makeWrapper since the Vulkan # layer can be used without the mangohud executable by setting MANGOHUD=1. @@ -126,11 +142,10 @@ in stdenv.mkDerivation rec { cd subprojects unzip ${imgui.patch} unzip ${spdlog.patch} + unzip ${vulkan-headers.patch} )''; mesonFlags = [ - "-Duse_system_vulkan=enabled" - "-Dvulkan_datadir=${vulkan-headers}/share" "-Dwith_wayland=enabled" ] ++ lib.optionals gamescopeSupport [ "-Dmangoapp_layer=true" @@ -147,7 +162,6 @@ in stdenv.mkDerivation rec { ninja pkg-config unzip - vulkan-loader ]; buildInputs = [ @@ -159,7 +173,6 @@ in stdenv.mkDerivation rec { glew glfw nlohmann_json - vulkan-headers xorg.libXrandr ];