diff options
author | rewine <luhongxu@deepin.org> | 2024-04-08 22:30:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 22:30:02 +0800 |
commit | 8b28d2cfd7c6b6c497d2f7dabf9e79daea1b5137 (patch) | |
tree | 64357d17964371433931b7eaa4938a42fc6c66ca /pkgs/by-name | |
parent | a2a144eeb84d0d5a51dbb542803443cb50c2cb01 (diff) | |
parent | 57f72cfbc2b9b242d075618351baf5b6296012f7 (diff) |
Merge pull request #302517 from Scrumplex/pkgs/gamescope/pin-wlr
gamescope: pin to wlroots_0_17
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/ga/gamescope/package.nix | 147 | ||||
-rw-r--r-- | pkgs/by-name/ga/gamescope/shaders-path.patch | 13 | ||||
-rw-r--r-- | pkgs/by-name/ga/gamescope/use-pkgconfig.patch | 9 |
3 files changed, 169 insertions, 0 deletions
diff --git a/pkgs/by-name/ga/gamescope/package.nix b/pkgs/by-name/ga/gamescope/package.nix new file mode 100644 index 0000000000000..a0dd62ab94941 --- /dev/null +++ b/pkgs/by-name/ga/gamescope/package.nix @@ -0,0 +1,147 @@ +{ stdenv +, fetchFromGitHub +, meson +, pkg-config +, ninja +, xorg +, libdrm +, vulkan-loader +, vulkan-headers +, wayland +, wayland-protocols +, libxkbcommon +, glm +, gbenchmark +, libcap +, libavif +, SDL2 +, pipewire +, pixman +, libinput +, glslang +, hwdata +, openvr +, stb +, wlroots +, libliftoff +, libdisplay-info +, lib +, makeBinaryWrapper +, nix-update-script +, enableExecutable ? true +, enableWsi ? true +}: +let + joshShaders = fetchFromGitHub { + owner = "Joshua-Ashton"; + repo = "GamescopeShaders"; + rev = "v0.1"; + hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA="; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gamescope"; + version = "3.14.2"; + + src = fetchFromGitHub { + owner = "ValveSoftware"; + repo = "gamescope"; + rev = "refs/tags/${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-Ym1kl9naAm1MGlxCk32ssvfiOlstHiZPy7Ga8EZegus="; + }; + + patches = [ + # Unvendor dependencies + ./use-pkgconfig.patch + + # Make it look for shaders in the right place + ./shaders-path.patch + ]; + + # We can't substitute the patch itself because substituteAll is itself a derivation, + # so `placeholder "out"` ends up pointing to the wrong place + postPatch = '' + substituteInPlace src/reshade_effect_manager.cpp --replace "@out@" "$out" + ''; + + mesonFlags = [ + (lib.mesonBool "enable_gamescope" enableExecutable) + (lib.mesonBool "enable_gamescope_wsi_layer" enableWsi) + ]; + + # don't install vendored vkroots etc + mesonInstallFlags = ["--skip-subprojects"]; + + strictDeps = true; + + depsBuildBuild = [ + pkg-config + ]; + + nativeBuildInputs = [ + meson + pkg-config + ninja + ] ++ lib.optionals enableExecutable [ + makeBinaryWrapper + glslang + ]; + + buildInputs = [ + pipewire + hwdata + xorg.libX11 + wayland + wayland-protocols + vulkan-loader + openvr + glm + ] ++ lib.optionals enableWsi [ + vulkan-headers + ] ++ lib.optionals enableExecutable [ + xorg.libXcomposite + xorg.libXcursor + xorg.libXdamage + xorg.libXext + xorg.libXi + xorg.libXmu + xorg.libXrender + xorg.libXres + xorg.libXtst + xorg.libXxf86vm + libavif + libdrm + libliftoff + SDL2 + wlroots + libinput + libxkbcommon + gbenchmark + pixman + libcap + stb + libdisplay-info + ]; + + postInstall = lib.optionalString enableExecutable '' + # --debug-layers flag expects these in the path + wrapProgram "$out/bin/gamescope" \ + --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]} + + # Install ReShade shaders + mkdir -p $out/share/gamescope/reshade + cp -r ${joshShaders}/* $out/share/gamescope/reshade/ + ''; + + passthru.updateScript = nix-update-script {}; + + meta = with lib; { + description = "SteamOS session compositing window manager"; + homepage = "https://github.com/ValveSoftware/gamescope"; + license = licenses.bsd2; + maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ]; + platforms = platforms.linux; + mainProgram = "gamescope"; + }; +}) diff --git a/pkgs/by-name/ga/gamescope/shaders-path.patch b/pkgs/by-name/ga/gamescope/shaders-path.patch new file mode 100644 index 0000000000000..bbdaf21a2e6fb --- /dev/null +++ b/pkgs/by-name/ga/gamescope/shaders-path.patch @@ -0,0 +1,13 @@ +diff --git a/src/reshade_effect_manager.cpp b/src/reshade_effect_manager.cpp +index 3597ca1..de45250 100644 +--- a/src/reshade_effect_manager.cpp ++++ b/src/reshade_effect_manager.cpp +@@ -34,7 +34,7 @@ static std::string GetLocalUsrDir() + + static std::string GetUsrDir() + { +- return "/usr"; ++ return "@out@"; + } + + static LogScope reshade_log("gamescope_reshade"); diff --git a/pkgs/by-name/ga/gamescope/use-pkgconfig.patch b/pkgs/by-name/ga/gamescope/use-pkgconfig.patch new file mode 100644 index 0000000000000..2b4de54ae54df --- /dev/null +++ b/pkgs/by-name/ga/gamescope/use-pkgconfig.patch @@ -0,0 +1,9 @@ +--- a/meson.build ++++ b/meson.build +@@ -6,7 +6,6 @@ project( + default_options: [ + 'cpp_std=c++20', + 'warning_level=2', +- 'force_fallback_for=wlroots,libliftoff,vkroots', + ], + ) |