I’m a fan of gaming - my main game is Overwatch. Until this week I’ve been using xwayland or gamescope to run Wine games which comes with downsides. Xwayland’s window management can be buggy - in Gnome I can end up unable to switch back to a game window. Gamescope has some latency and visual artifact issues in my preferred window manager.
But now with the Wine 10 release candidates you can run Wine in native Wayland mode without any special registry settings or anything. And it works very well as far as I can tell! I went through the trouble of figuring out how to get Wine 10 set up on NixOS so I thought I would share.
Wine 10 is currently available in nixos-unstable
. The simplest way I’ve found to get it working for games is to use Lutris, and to install both Lutris and Wine from unstable. To get a complete Wine setup for Lutris use wineWowPackages
- for example wineWowPackages.stagingFull
. The Full
variant includes wine-mono
which you’ll probably want, and the staging package is the one that worked for me.
I have an overlay that lets me reference unstable packages via pkgs.unstable.${package-name}
. With that in place I have this in my NixOS settings:
environment.systemPackages = [
(pkgs.unstable.lutris.override {
extraPkgs = pkgs: [
# ----
# ↓ same var ↑
# ----
pkgs.wineWowPackages.stagingFull
pkgs.winetricks
];
})
];
Note that you’ll want to use the shadowed pkgs
variable introduced in the function given to extraPkgs
to reference the wine packages. I think that package set has some extra FHS stuff done to it or something.
If you don’t have it already the shortcut for enabling necessary system settings for running games with Vulkan is to enable steam:
programs.steam.enable = true;
You can presumably put the Lutris configuration in Home Manager instead of NixOS by setting home.packages
instead of environment.systemPackages
. The steam setting needs to be set in NixOS.
When you run Lutris change the Wine runner settings to use the “system default” Wine version, and check the “use system winetricks” toggle.
To make sure that Wine uses Wayland you can unset the DISPLAY
environment variable, or set it to an empty string. To do that in Lutris go into the game configuration settings. Under the “System options” tab add an environment variable named DISPLAY
, and leave its value empty.
And that’s it!
The one issue I’ve run into is that the Battle.net launcher is a blank black rectangle. The workaround is to run the launcher in gamescope or xwayland, install the game you want, and then re-launch without gamescope in native Wayland. You can start the game you want using the menu from Battle.net’s system tray icon so that you don’t need to use the launcher UI.
Edit: Thanks @vividspecter@lemm.ee for the point about unsetting DISPLAY
!
Edit: @BlastboomStrice@mander.xyz pointed out that all of the Wine packages on unstable are updated to v10 so I changed the instructions to use stableFull
instead of stagingFull
.
Edit: stableFull
wasn’t actually working for me so I switched the instructions back to stagingFull
One more thing you need to do (unless you’ve disabled XWayland) is to unset the DISPLAY variable when launching a game:
I haven’t tested it but it should work in the launch options for a game on Steam too (provided the game is using Proton).
Good point! There is also a spot you can set this in game settings in Lutris.
I haven’t tried this in Steam. Steam still requires X11. Can Steam spawn a native Wayland window if it’s running in xwayland? I assumed not which is why I went through Lutris. But if it can that would be great!
Edit: Oh yeah, Steam can launch native Wayland games! Now that I think about it that makes sense - Steam spawns a sub-process that manages its own windows so the sub-process doesn’t get stuck in X11 land. This is great! I thought I was going to have to wait forever for Valve to release a Steam update with Wayland support!
I think the Proton options that Steam provides are not updated to Wine 10 yet so they won’t run in Wayland without the special registry setting that the previous Wine version requires? I tried hacking in a custom compatibility runner that runs wine from the Nix package, but I got a message saying that a running instance of steam could not be found. But I was able to get a runner that works from wine-tkg-git by following instructions here.
proton-tkg-build
~/.steam/root/compatibilitytools.d/
Yeah I should have noted it’s not in official Proton yet but good to know it’s working with TKG.