about summary refs log tree commit diff
path: root/pkgs/tools/graphics/mangohud
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-04-13 11:34:44 +0300
committerK900 <me@0upti.me>2023-04-13 11:34:44 +0300
commit04be1e4a9f62c6a595d999e7793e2eea295b00a0 (patch)
tree42748d4e97182ce1afd28b4ca3d48a53680eba9f /pkgs/tools/graphics/mangohud
parent693bc82c4bd92eab8179f1ec23662648ed84b831 (diff)
mangohud: use vendored vulkan-headers to fix build
This isn't great but what can you do.
Diffstat (limited to 'pkgs/tools/graphics/mangohud')
-rw-r--r--pkgs/tools/graphics/mangohud/default.nix25
1 files changed, 19 insertions, 6 deletions
diff --git a/pkgs/tools/graphics/mangohud/default.nix b/pkgs/tools/graphics/mangohud/default.nix
index 8bdf4938ed581..d4aaa79a7c76c 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
   ];