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
I'm gonna take a couple of stabs in the dark.
According to this Stack Overflow answer using
tee
can prevent the prompt from drawing which makes it appear that a script has not terminated. The answerer's workaround is to put a very short sleep command after the tee command.If this is what happened to you maybe the reason the script works in bash but not in zsh is because you have different prompts configured in those two shells.
Another idea is to replace
tee
withsponge
frommoreutils
. The difference is thatsponge
waits for the end of stdin before it starts writing which can avoid problems in some situations.