2022-08-12 12:06:08 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, pkg-config
|
|
|
|
, ninja
|
|
|
|
, xorg
|
|
|
|
, libdrm
|
|
|
|
, vulkan-loader
|
2023-03-15 16:39:30 +00:00
|
|
|
, vulkan-headers
|
2022-08-12 12:06:08 +00:00
|
|
|
, wayland
|
|
|
|
, wayland-protocols
|
|
|
|
, libxkbcommon
|
2023-07-15 17:15:38 +00:00
|
|
|
, glm
|
|
|
|
, gbenchmark
|
2022-08-12 12:06:08 +00:00
|
|
|
, libcap
|
|
|
|
, SDL2
|
|
|
|
, pipewire
|
|
|
|
, pixman
|
|
|
|
, libinput
|
|
|
|
, glslang
|
2023-03-15 16:39:30 +00:00
|
|
|
, hwdata
|
|
|
|
, openvr
|
2022-08-12 12:06:08 +00:00
|
|
|
, stb
|
|
|
|
, wlroots
|
|
|
|
, libliftoff
|
2023-03-15 16:39:30 +00:00
|
|
|
, libdisplay-info
|
2022-08-12 12:06:08 +00:00
|
|
|
, lib
|
|
|
|
, makeBinaryWrapper
|
2024-01-13 08:15:51 +00:00
|
|
|
, enableExecutable ? true
|
|
|
|
, enableWsi ? true
|
2022-08-12 12:06:08 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-01-13 08:15:51 +00:00
|
|
|
joshShaders = fetchFromGitHub {
|
2023-03-15 16:39:30 +00:00
|
|
|
owner = "Joshua-Ashton";
|
2024-01-13 08:15:51 +00:00
|
|
|
repo = "GamescopeShaders";
|
|
|
|
rev = "v0.1";
|
|
|
|
hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA=";
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
2022-08-12 12:06:08 +00:00
|
|
|
in
|
2024-01-13 08:15:51 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "gamescope";
|
|
|
|
version = "3.13.19";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-04-12 12:48:02 +00:00
|
|
|
owner = "ValveSoftware";
|
2022-08-12 12:06:08 +00:00
|
|
|
repo = "gamescope";
|
2024-01-13 08:15:51 +00:00
|
|
|
rev = "refs/tags/${finalAttrs.version}";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
hash = "sha256-WKQgVbuHvTbZnvTU5imV35AKZ4AF0EDsdESBZwVH7+M=";
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
patches = [
|
2024-01-13 08:15:51 +00:00
|
|
|
# Unvendor dependencies
|
2023-03-15 16:39:30 +00:00
|
|
|
./use-pkgconfig.patch
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# 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)
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# don't install vendored vkroots etc
|
|
|
|
mesonInstallFlags = ["--skip-subprojects"];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
strictDeps = true;
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
2023-03-15 16:39:30 +00:00
|
|
|
];
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
pkg-config
|
|
|
|
ninja
|
2024-01-13 08:15:51 +00:00
|
|
|
] ++ lib.optionals enableExecutable [
|
2022-08-12 12:06:08 +00:00
|
|
|
makeBinaryWrapper
|
2024-01-13 08:15:51 +00:00
|
|
|
glslang
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
pipewire
|
|
|
|
hwdata
|
|
|
|
xorg.libX11
|
|
|
|
wayland
|
|
|
|
wayland-protocols
|
|
|
|
vulkan-loader
|
|
|
|
openvr
|
|
|
|
glm
|
|
|
|
] ++ lib.optionals enableWsi [
|
|
|
|
vulkan-headers
|
|
|
|
] ++ lib.optionals enableExecutable [
|
2022-08-12 12:06:08 +00:00
|
|
|
xorg.libXcomposite
|
2024-01-13 08:15:51 +00:00
|
|
|
xorg.libXcursor
|
|
|
|
xorg.libXdamage
|
2022-08-12 12:06:08 +00:00
|
|
|
xorg.libXext
|
|
|
|
xorg.libXi
|
2023-03-15 16:39:30 +00:00
|
|
|
xorg.libXmu
|
2024-01-13 08:15:51 +00:00
|
|
|
xorg.libXrender
|
|
|
|
xorg.libXres
|
|
|
|
xorg.libXtst
|
|
|
|
xorg.libXxf86vm
|
2022-08-12 12:06:08 +00:00
|
|
|
libdrm
|
|
|
|
libliftoff
|
|
|
|
SDL2
|
|
|
|
wlroots
|
|
|
|
libinput
|
|
|
|
libxkbcommon
|
2023-07-15 17:15:38 +00:00
|
|
|
gbenchmark
|
2022-08-12 12:06:08 +00:00
|
|
|
pixman
|
|
|
|
libcap
|
|
|
|
stb
|
2023-03-15 16:39:30 +00:00
|
|
|
libdisplay-info
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
postInstall = lib.optionalString enableExecutable ''
|
|
|
|
# --debug-layers flag expects these in the path
|
2022-08-12 12:06:08 +00:00
|
|
|
wrapProgram "$out/bin/gamescope" \
|
2023-10-09 19:29:22 +00:00
|
|
|
--prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]}
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# Install ReShade shaders
|
|
|
|
mkdir -p $out/share/gamescope/reshade
|
|
|
|
cp -r ${joshShaders}/* $out/share/gamescope/reshade/
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "SteamOS session compositing window manager";
|
2023-04-12 12:48:02 +00:00
|
|
|
homepage = "https://github.com/ValveSoftware/gamescope";
|
2022-08-12 12:06:08 +00:00
|
|
|
license = licenses.bsd2;
|
2024-01-13 08:15:51 +00:00
|
|
|
maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ];
|
2022-08-12 12:06:08 +00:00
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "gamescope";
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
2024-01-13 08:15:51 +00:00
|
|
|
})
|