37 , enableExecutable ? true
41 joshShaders = fetchFromGitHub {
42 owner = "Joshua-Ashton";
43 repo = "GamescopeShaders";
45 hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA=";
48 stdenv.mkDerivation (finalAttrs: {
52 src = fetchFromGitHub {
53 owner = "ValveSoftware";
55 rev = "refs/tags/${finalAttrs.version}";
56 fetchSubmodules = true;
57 hash = "sha256-LVwwkISokjSXEYd/SFRtCDDY6P2sr6pQp8Xb8BsrXAw=";
61 # Make it look for shaders in the right place
63 # patch relative gamescopereaper path with absolute
64 ./gamescopereaper.patch
67 # We can't substitute the patch itself because substituteAll is itself a derivation,
68 # so `placeholder "out"` ends up pointing to the wrong place
70 substituteInPlace src/reshade_effect_manager.cpp --replace "@out@" "$out"
71 # Patching shebangs in the main `libdisplay-info` build
72 patchShebangs subprojects/libdisplay-info/tool/gen-search-table.py
73 # Replace gamescopereeaper with absolute path
74 substituteInPlace src/Utils/Process.cpp --subst-var-by "gamescopereaper" "$out/bin/gamescopereaper"
78 (lib.mesonBool "enable_gamescope" enableExecutable)
79 (lib.mesonBool "enable_gamescope_wsi_layer" enableWsi)
82 # don't install vendored vkroots etc
83 mesonInstallFlags = ["--skip-subprojects"];
96 # For `libdisplay-info`
103 # calls git describe to encode its own version into the build
104 (writeShellScriptBin "git" "echo ${finalAttrs.version}")
105 ] ++ lib.optionals enableExecutable [
118 ] ++ lib.optionals enableWsi [
120 ] ++ lib.optionals enableExecutable (wlroots.buildInputs ++ [ # gamescope uses a custom wlroots branch
145 postInstall = lib.optionalString enableExecutable ''
146 # using patchelf unstable because the stable version corrupts the binary
147 ${lib.getExe buildPackages.patchelfUnstable} $out/bin/gamescope \
148 --add-rpath ${vulkan-loader}/lib --add-needed libvulkan.so.1
150 # --debug-layers flag expects these in the path
151 wrapProgram "$out/bin/gamescope" \
152 --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]}
154 # Install ReShade shaders
155 mkdir -p $out/share/gamescope/reshade
156 cp -r ${joshShaders}/* $out/share/gamescope/reshade/
159 passthru.updateScript = nix-update-script {};
162 description = "SteamOS session compositing window manager";
163 homepage = "https://github.com/ValveSoftware/gamescope";
164 license = licenses.bsd2;
165 maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ];
166 platforms = platforms.linux;
167 mainProgram = "gamescope";