Change:
Project description This is the Wayland based compositor that Valve is using, that when paired with a running application, can fix minimizing and other such issues, as well as allowing AMD FSR on any application. Metadata homepage URL: source URL: license: BSD 2 Clause platforms: Linux
For those interested, it's available in the NUR:
I can take care of porting the NUR derivation to nixpkgs and becoming the official maintainer. Just need a few weeks to understand the codebase a bit before committing to it.
Are you still interested in doing that? Would love to see this in nixpkgs :)
I read on NixOS's discord that is a blocker.
Yeah, that issue kinda upset me. I've been accompanying its progress but not being able to use controller for gamescope games suck. I do intend to free up some time to work on this. The NUR package was very oudated and not so well written at the time I checked it out, so I'd most likely would have to refactor it, which would take some effort.
managed to package it for their project . They opted to re-build the submodules using the Nix packages' srcs which should be remedied for inclusion into Nixpkgs.
Oh nice, that helps a lot.
I did it this way as a shortcut. It would probably be best to have an "updater" script next to the derivation that builds a attrset with the same exact source trees the git submodules point to. Though I haven't seen any weirdness, so I don't think that it would matter currently.
Of course, yes. I think it'd be sufficient to make gamescope dependent on the output paths instead of the subproject build result; just like any other dependency. Should gamescope require special versions of those dependencies in the future, we should be able to easily provide those. Were you able to make gamescope work from within Steam (as in: )? When I tried that, it was unable to find a free X11 socket for xwayland due to what seems like the bubblewrap container interfering with UIDs?
I've only used gamescope to run the new steamos interface, so games were in gamescope since steam itself was in gamescope. I haven ot tried any other kind of use. I tested it nested (within X11) and directly off of KMS.
I've tried prepending games in steam with , but as Atemu said, thy don't run, failing with that exact error. So I've tried running the games without steam, by going to their directories and running . That still didn't work (because of binary incompatibility), so I ran , which actually works outside of steam, but still fails inside. If anyone knows how to debug this, I'd be happy to help.
Meant to say I also the flag but forgot. It was there and still not working.
I tried in various cases, here are the results: on X: I can run commands/games through gamescope on X: I failed to run steam games with gamescope (error message about /tmp/.X11-unix ownership) on X: I failed to run lutris games with gamescope (same error as with steam) on X: I can start steam or lutris in gamescope so the games inherits the environment, it's not practical at allon wayland: same results than with Xon bare wayland without using a display manager: I can use gamescope with Lutris on bare wayland without using a display manager: Steam games with gamescope in the launcher options are running, but no window are displayed... tested with intel GPU and nvidia dedicated GPU on NixOS unstable For the intel GPU, sometimes there are corruption in the image, using environment variable solve this issue. This is tracked in gamescope repository issues.
I tried to use it in Steam by putting into a game's launch options, but it crashes with a segfault (see logs). I'm running an AMD Zen 3 CPU & RDNA2 GPU w/ RADV. <details<summarylogs</summary</details
Check the stdout/err log, it's probably the xwayland issue.
I'm able to use the flatpak gamescope with few problems (doens't work well with the vanilla proton, but it works with the recent versions of proton-ge just fine apparently)
FWIW, I have to use the patch mentioned here to get it to work on the Intel chip (the Nvidia works fine without it though, in my optimus setup):
Oh nice!
I tried to run the nixpkgs gamescope to open the 0ad game to test it out, and it failed on swaywm:
It's the xwayland issue as I suspected. I think we should have a separate issue on that.
I don't think that's our issue, there is an upstream issue as well as a PR to potentially address it: Plagman/gamescope
When I dug into this a while ago, it was due to it not being able to start its own xwayland session because a directory was owned by nobody rather than root or the current user inside our container IIRC.
I'm hitting a problem when attempting to use the package that sounds similar. It attempts to use the socket, which is owned by the currently logged in user. Im a bit confused as to why this socket isnt owned by root in the first place, looking at some documentation from Xorgs it seems like that is required: This issue seems to stem from (which I use) from what I can tell. Its explains that , although I havent double checked if the issue occurs with other display managers. are you also using ? Log: Afterwards it exits, so no games launch.
I use SDDM in combination with sway or i3.
Gdm with gnome wayland here. In my case is owned by root, and gamescope just exit with the same error. After I made the current user the owner, gamescope made some progress, and but exit with the follow error: Maybe it's xwayland's issue?
Is propagated into the environment? had a seemingly similar issue fixed with that. Might need to add it to steams chroot env if it isn't already.
Might want to give a try Also, I have an open PR to allow one to add a gamescope based steam session to your display manager, would appreciate it if some folks here could give it a review:
After adding and to steam, with 3.11.39, I tested several native and proton games, they all worked without any further issue.
mind showing exactly how you did it?
Yes, the two packages are in steam's extraPkgs. And launch option in steam
Are you running that in Xorg? I tried the same steps on Wayland and it still fails with the errors.
I'm on wayland, you still have to manually run here. I don't know much about how wayland/xorg work, I have to manually set the owner every time after reboot.
FWIW this also works on sway. is owned by root, so that must be chowned first.
There must be something different, because I have launched gamescope in embedded mode, from a wayland session and from an X session, and I never had to chown anything
Same, nested (X11) and embedded (VT) worked on my end without anything wonky Just in case, here's my groups:
I've tried your suggestion with extraPackages. Doesn't seem to work for me, even when chowning X11-lock: I still get krb5 errors and the game doesn't show up, but steam reports it as running. Perhaps I missed a step? Config is . EDIT: My bad, I was using but I was building my system with an explicit pass. Moving the override in the import solved the issue. Sorry for necro-ing!
Using xorg & SDDM, and I do seem to have to for gamescope launched from within Steam to work. But, that directory is owned by root on my system, so why doesn't it work? Quick check of what things look like within steam's FHS env namespace reveals the issue: It appears that Steam's namespace maps all instances of users other than the current one in to , and this causes the issue. This is also why it works fine for me if I use it outside of Steam. This behaviour is coming from bubblewrap, which uses under the hood, but I'm not sure how to fix this. I believe Flatpak also uses bubblewrap for sandboxing, so if this is working with Flatpak Steam, it may be worth taking a look at what it's doing...
gamescope does work in Flatpak Steam, I did some digging and is mostly equivalent to passing in 's call to , for the appropriate socket name instead of just assuming , and some sanity checks on ensuring it actually exists to begin with. I don't think it's currently possible to replicate that code in nixpkgs; I think we'd need the ability to prepend some additional bash to 's .
Did anyone mange to get past this issue?
Workaround: The solution was a combination of multiple steps: MangoHud if used globally: (Alternatively it sounds like it's possible to bypass the segmentation fault with ) 't force Wayland since GameScope still uses XWayland. The biggest culprit seems to be , leaving it unset might be the best idea. Here's my envs on Hyprland: undefined symbols in X11 session (Thanks was able to use GameScope with GameMode and MangoHud like this with my 3840x1600 display in Steam. Goto Steam Game Properties Launch Options and add: Some minor issues that I've encountered with GameScope: GameScope breaks my keyboard layout (maybe because I don't use ?). The game (sometimes) continues to run in the background after closing it from Steam. Seems like fonts are rendered slightly differently (meaning more sharp while they're smooth/antialiased outside GameScope, perhaps this is relevant: ). I benchmarked GameScope versus running directly in Wayland with my configuration and I found the Wayland session to be noticeably smoother. Frametimes and FPS were slightly better in Hyprland/Wayland according to MangoHud with Xanmod 6.2 kernel and performance governor. I also found that GameScope performs a lot better when VRR is enabled and direct scanout is disabled: . Hope this helps anyone!

Discussion:
<ins> { stdenv , fetchFromGitHub , meson , pkg-config , ninja , xorg , libdrm , vulkan-loader , wayland , wayland-protocols , libxkbcommon , libcap , SDL2 , pipewire , udev , pixman , libinput , libseat , xwayland , glslang , stb , wlroots , libliftoff , lib , makeBinaryWrapper }: let pname = "gamescope"; version = "3.11.33-jupiter-3.3-2"; in stdenv.mkDerivation { inherit pname version; src = fetchFromGitHub { owner = "Plagman"; repo = "gamescope"; rev = "refs/tags/${version}"; hash = "sha256-6/gTsQGZDQPCdmXe5EI9QcT/MkdTf6odsI2/+g/W7Qc="; }; patches = [ ./use-pkgconfig.patch ]; nativeBuildInputs = [ meson pkg-config ninja makeBinaryWrapper ]; buildInputs = [ xorg.libXdamage xorg.libXcomposite xorg.libXrender xorg.libXext xorg.libXxf86vm xorg.libXtst xorg.libXres xorg.libXi libdrm libliftoff vulkan-loader glslang SDL2 wayland wayland-protocols wlroots xwayland libseat libinput libxkbcommon udev pixman pipewire libcap stb ]; # --debug-layers flag expects these in the path postInstall = '' wrapProgram "$out/bin/gamescope"  --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]} ''; meta = with lib; { description = "SteamOS session compositing window manager"; homepage = "https://github.com/Plagman/gamescope"; license = licenses.bsd2; maintainers = with maintainers; [ nrdxp ]; platforms = platforms.linux; }; } </ins>

<ins> diff --git a/meson.build b/meson.build index 1311784..77043ac 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,6 @@ project( default_options: [ 'cpp_std=c++14', 'warning_level=2', -    'force_fallback_for=wlroots,libliftoff', ], ) </ins>

libgamemode32 = pkgsi686Linux.gamemode.lib; }; <ins> gamescope = callPackage ../applications/window-managers/gamescope { }; </ins> gay = callPackage ../tools/misc/gay {  }; elkhound = callPackage ../development/tools/elkhound { };