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

  • Blastboom Strice
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 hours ago

    Oh yes, I later realised that in your post you made nixos fetch from unstable. I’m using only the unstable nixpkgs branch😅

    I see though, if it runs properly on your device it probably would on mine too.

    About bottles, I just created a bottle, selected “custom” (not application or game category) and I picked the runner I wanted (sys-wine 10.0). You can also change it later from settings/runner:)

    Funnily, I had issues with lutris, couldnt get it to run properly, but I think it may have been cuz I had forgotten to enable 32bit support. Lol, with lutris and bottles it seems like half the people can only use the former and half only the latter.

    PS. I was running the wayland variant at 8.2 and it was working properly on my plasma/wayland desktop. Maybe it wouldnt without it back when they didnt properly support it.