34 , enableExecutable ? true
38 joshShaders = fetchFromGitHub {
39 owner = "Joshua-Ashton";
40 repo = "GamescopeShaders";
42 hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA=";
45 stdenv.mkDerivation (finalAttrs: {
49 src = fetchFromGitHub {
50 owner = "ValveSoftware";
52 rev = "refs/tags/${finalAttrs.version}";
53 fetchSubmodules = true;
54 hash = "sha256-+8uojnfx8V8BiYAeUsOaXTXrlcST83z6Eld7qv1oboE=";
58 # Make it look for shaders in the right place
60 # patch relative gamescopereaper path with absolute
61 ./gamescopereaper.patch
64 # We can't substitute the patch itself because substituteAll is itself a derivation,
65 # so `placeholder "out"` ends up pointing to the wrong place
67 substituteInPlace src/reshade_effect_manager.cpp --replace "@out@" "$out"
68 # Patching shebangs in the main `libdisplay-info` build
69 patchShebangs subprojects/libdisplay-info/tool/gen-search-table.py
70 # Replace gamescopereeaper with absolute path
71 substituteInPlace src/Utils/Process.cpp --subst-var-by "gamescopereaper" "$out/bin/gamescopereaper"
75 (lib.mesonBool "enable_gamescope" enableExecutable)
76 (lib.mesonBool "enable_gamescope_wsi_layer" enableWsi)
79 # don't install vendored vkroots etc
80 mesonInstallFlags = ["--skip-subprojects"];
92 # For `libdisplay-info`
98 ] ++ lib.optionals enableExecutable [
111 ] ++ lib.optionals enableWsi [
113 ] ++ lib.optionals enableExecutable (wlroots.buildInputs ++ [ # gamescope uses a custom wlroots branch
137 postInstall = lib.optionalString enableExecutable ''
138 # using patchelf unstable because the stable version corrupts the binary
139 ${lib.getExe patchelfUnstable} $out/bin/gamescope \
140 --add-rpath ${vulkan-loader}/lib --add-needed libvulkan.so.1
142 # --debug-layers flag expects these in the path
143 wrapProgram "$out/bin/gamescope" \
144 --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]}
146 # Install ReShade shaders
147 mkdir -p $out/share/gamescope/reshade
148 cp -r ${joshShaders}/* $out/share/gamescope/reshade/
151 passthru.updateScript = nix-update-script {};
154 description = "SteamOS session compositing window manager";
155 homepage = "https://github.com/ValveSoftware/gamescope";
156 license = licenses.bsd2;
157 maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ];
158 platforms = platforms.linux;
159 mainProgram = "gamescope";