HDR on NixOS status?

What’s the state of being able to play HDR content on NixOS? It looks like it’s at least possible to play several games in HDR mode on Linux since January 2023. Gamescope is available in nixpkgs, but I don’t know how to run it standalone, or whether the Gamescope kernel patches have made it into something easy to use on NixOS.

If anyone has set this or something similar up on NixOS it would be great to hear about it.

We have an option to enable HDR on Chaotic Nyx:



You’d use NixOS Search

No idea if it’s in any of the kernels, but nixpkgs has many kernels. Set them with NixOS Search

If you can’t figure out what kernels may contain the correct patches or how to apply them manually, looks like chaotic nyx is indeed a good bet.

I’ve set gamescopeSession.enable = true, but I can’t tell from the description whether that’s necessary or sufficient. There’s no mention of “standalone” in the search page or in steam.nix.

Cool, thanks! I’ve applied these changes, so I guess now it’s just a matter of waiting until 23.05 or 23.11 gets these package versions?

(It’s cool that you’re maintaining your own packages, and fantastic that you’re helping to bring HDR to people. However, gaming is only one of many things I do on this machine, and I’d rather not spend too much time off of mainline nixpkgs if I can help it, so I’d rather just wait for a stable channel to include the necessary packages.)

1 Like

I don’t understand your confusion. “Session” is the term used to describe a set of applications/scripts run to compose a graphical environment.

Gamescope is a wayland compositor. Wayland compositors can generally either be used as a nested client, which is usually more of a testing thing, but for gamescope it’s used to wrap a specific application to make it behave better (for managing resolution, limiting framerates, better fullscreen behavior and such).

However when run standalone, you use it as the compositor to drive your graphical session. Since it has full control over the monitor, it can then do things like support hdr and provide more efficient rendering.

I.e., this here:

Run a GameScope driven Steam session from your display-manager

Means “create a “standalone” gamescope session and launch steam in it when you select the session in gdm”.

Or is the question whether running a gamescope session is required for hdr? According to what I’ve seen currently, yes, as no other wayland compositor nor X implements it yet.

1 Like

“Session” is the term used to describe a set of applications/scripts run to compose a graphical environment.

Yep, that’s one thing I did know already.

Gamescope is a wayland compositor.

Thank you, I did not know that. The rest of your paragraph adds useful info to that, but it wasn’t obvious from any of the context so far.

Run a GameScope driven Steam session from your display-manager

Means “create a “standalone” gamescope session and launch steam in it when you select the session in gdm”.

You mean at initial login to GNOME? That doesn’t seem to make sense. Why wouldn’t that just be an option in services.xserver.desktopManager in that case? Why tie it to Steam at all?

Ah! Yeah, people need better education on what gamescope actually is/does, it’s hailed as a cureall and magical performance wand when in reality it has a much narrower scope (heh).

I’m not sure how the NixOS docs could improve the situation though, besides…

Yeah, I have no idea why it has its own separate option either. If you don’t believe me, just look at the source, it literally creates a desktop session file: https://github.com/NixOS/nixpkgs/blob/9075cba53e86dc318d159aee55dc9a7c9a4829c1/nixos/modules/programs/steam.nix#L18

My guess is that it’s because the author didn’t want to put it under xserver, because that’d make no sense, and none of the other wayland compositors are under it either (besides gnome and KDE, but those are special).

There are no standards around wayland session setup to factor into a module yet either, so presumably what could have been services.wayland.sessions.steam became programs.steam.gamescopeSession.

Because gamescope is the wayland compositor for SteamOS, it’s kind of designed to launch steam in big picture mode for the steamdeck.

And since there are no standards for wayland sessions yet, there’s no reasonable way to provide you with an actual UI to do something, besides launching steam in big picture mode which will take on that responsibility as per valve’s design.

*At initial login to your graphical session. gdm can launch other sessions besides gnome, and is not the only display manager implementation.

1 Like

Hah, I’m spot-on with my guesses: https://github.com/NixOS/nixpkgs/pull/187507#issuecomment-1229497398

Woah, lots to absorb here. :smiley: Thank you both for your help!

Update: The first time I tried to log in to a Gamescope session it just stayed black for a few seconds and then crashed back into the login screen. The second and third tries it showed a “Verifying installation” screen for a few seconds before also returning to the login screen. The last few lines of gdm-wayland-session output:

wlserver: [types/wlr_compositor.c:673] New wlr_surface 0x22391c0 (res 0x277b7c0)
xwm: got the same buffer commited twice, ignoring.
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
/nix/store/2czm89w8qlyf80v6shr7g4kjvns2fya1-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so: wrong ELF class: ELFCLASS64
Failed to load module: /nix/store/2czm89w8qlyf80v6shr7g4kjvns2fya1-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so
/nix/store/v3sqf3iq10d0whc9bv8k1vb00b59qlbi-gvfs-1.50.4/lib/gio/modules/libgvfsdbus.so: wrong ELF class: ELFCLASS64
Failed to load module: /nix/store/v3sqf3iq10d0whc9bv8k1vb00b59qlbi-gvfs-1.50.4/lib/gio/modules/libgvfsdbus.so
GetWin32Stats: display was not open yet, good

Presumably “libgvfsdbus.so: wrong ELF class: ELFCLASS64” is the key here, but that kind of error message is completely foreign to me. Is it simply saying I’m missing the 32-bit version of that library?

I suspect so (or rather, your system lacks support for 32bit applications, which steam needs), have you set NixOS Search ?

It may be complicated to understand what’s going on with the logs when using a DM, so go to tty3, login in plain text, and start “steam-gamescope” executable. You can tee its output to a file (include 2>&1). Just remember that you can’t have multiple Steam started between DMs.

Also, you can use nixpkgs’ kernels, if you apply the proper patch (https://search.nixos.org/options?channel=unstable&show=boot.kernelPatches), cachyos keep it squashed and updated here: https://github.com/CachyOS/kernel-patches/blob/d792451352838e29b6b0e4a297e897bf1bb975fe/6.5/0001-amd-hdr.patch



$ nix repl --file '<nixpkgs/nixos>'
Welcome to Nix 2.13.3. Type :? for help.

Loading installable ''...
Added 6 variables.
nix-repl> config.hardware.opengl.driSupport32Bit

Bummer. dconf is part of GNOME (or rather, an underlying configuration manager for all kinds of gtk-based things). It should not be launching as part of the steam session as far as I know, so it even showing in your logs is frankly unusual.

So my suspicion is that this is something going wrong in gdm when launching this steam session, which is not all that surprising given how badly standardized wayland sessions currently are.

Have you tried @PedroHLC 's suggestion of running steam-gamescope as-is from a different tty (Ctrl+Alt+F5 should give you one, the one with gdm should be on F1, F4 or F7, not sure which on NixOS off the top of my head)? That would eliminate one point of failure.

Yep, when run in a virtual terminal it does (mostly) work. The only missing piece seems to be HDR support, because the colours all look washed out. I’ll probably just wait for the kernel patches to be mainlined (presumably by 23.11).

1 Like