diff options
author | Atemu <atemu.main@gmail.com> | 2023-05-14 18:17:29 +0200 |
---|---|---|
committer | Atemu <atemu.main@gmail.com> | 2023-05-14 18:25:15 +0200 |
commit | 272154f2602ac55700c15cf38f84c44a67fb11b0 (patch) | |
tree | 1a340b24cfff8d790c0045a051effce52398089c /pkgs/tools/graphics/mangohud | |
parent | 897876e4c484f1e8f92009fd11b7d988a121a4e7 (diff) |
mangohud: add bitness suffix to layer name
The VK loader finds the 32-bit layer first and does not attempt to load the 64-bit layer afterwards; likely because it shares the same name. Simply giving them different names fixes the issue; both layers are tried and the correct one succeeds. A similar patter is employed by obs-vkcapture which continued working after https://github.com/NixOS/nixpkgs/pull/228870. Fixes https://github.com/NixOS/nixpkgs/issues/230978
Diffstat (limited to 'pkgs/tools/graphics/mangohud')
-rw-r--r-- | pkgs/tools/graphics/mangohud/default.nix | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/pkgs/tools/graphics/mangohud/default.nix b/pkgs/tools/graphics/mangohud/default.nix index 5b6e5e8e76dea..7903155af40d7 100644 --- a/pkgs/tools/graphics/mangohud/default.nix +++ b/pkgs/tools/graphics/mangohud/default.nix @@ -194,16 +194,26 @@ stdenv.mkDerivation (finalAttrs: { ''} ''; - postFixup = '' + postFixup = let + archMap = { + "x86_64-linux" = "x86_64"; + "i686-linux" = "x86"; + }; + layerPlatform = archMap."${stdenv.hostPlatform.system}" or null; + # We need to give the different layers separate names or else the loader + # might try the 32-bit one first, fail and not attempt to load the 64-bit + # layer under the same name. + in lib.optionalString (layerPlatform != null) '' + substituteInPlace $out/share/vulkan/implicit_layer.d/MangoHud.${layerPlatform}.json \ + --replace "VK_LAYER_MANGOHUD_overlay" "VK_LAYER_MANGOHUD_overlay_${toString stdenv.hostPlatform.parsed.cpu.bits}" + '' + '' # Add OpenGL driver path to RUNPATH to support NVIDIA cards addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so" - ${lib.optionalString gamescopeSupport '' - addOpenGLRunpath "$out/bin/mangoapp" - ''} - ${lib.optionalString finalAttrs.doCheck '' - # libcmocka.so is only used for tests - rm "$out/lib/libcmocka.so" - ''} + '' + lib.optionalString gamescopeSupport '' + addOpenGLRunpath "$out/bin/mangoapp" + '' + lib.optionalString finalAttrs.doCheck '' + # libcmocka.so is only used for tests + rm "$out/lib/libcmocka.so" ''; passthru.updateScript = nix-update-script { }; |