this post was submitted on 23 Jul 2024
30 points (100.0% liked)

Nix / NixOS

1768 readers
1 users here now

Main links

Videos

founded 1 year ago
MODERATORS
 

Hi, I am considering switching to NixOS and I was wondering what level of hassle I should expect for gaming.

I have been using linux for about 10 months so I don't know a lot yet. I am wondering if it is worth it to try gaming on Nix or if it is going to be way too much of a headache considering my limited knowledge.

I've had wildly different experiences trying gaming on different distros, and very differently from what I expected. It went from fine for a weird niche distro (antiX), to really awful for a distro supposedly "easy" and "good for gaming" (Manjaro ๐Ÿ˜‘), to absolutely amazing gaming distro (Nobara), and finally to surprisingly good for a "don't try unless you are a Level 99 Tech Wizard dual-classed Zen Master you idiot" distro (Arch). So I really have no clue what to expect from Nix.

I really like Arch but my main issue is that I keep forgetting what I have already configured and how and with which settings, or I leave stuff partially configured because adhd then I forget it wasn't finished and where I was at, so using config files instead sound insanely more convenient and I've been wanting to try Nix for a while.

I'd be really glad for anyone willing to share their experience of gaming on Nix ๐Ÿ™‚

top 26 comments
sorted by: hot top controversial new old
[โ€“] verstra 12 points 3 months ago (1 children)

In my case, it just worked, on two machines. Just added steam and lutris into the config along with two other options recommended for gaming and it worked.

[โ€“] [email protected] 8 points 3 months ago

Specifically programs.steam.enable = true sets up the direct rendering and 32-bit libraries that you generally need.

I was confused at first about how to install wine runners in Lutris or in Bottles. It turns out you do it the same way as in any other distro, through the app.

[โ€“] [email protected] 12 points 3 months ago (2 children)
[โ€“] [email protected] 6 points 3 months ago (1 children)

Wait how did I watch so many videos of this channel in preparation for switching to Nix but miss this one ? ๐Ÿ˜‚ (Thanks !)

[โ€“] [email protected] 3 points 3 months ago

The title is really weird. I overlooked the vid when I wrote the last comment at first, too.

[โ€“] tatterdemalion 4 points 3 months ago

Oh that's awesome. I've been gaming on NixOS for a while and I never knew about gamemode.

[โ€“] [email protected] 8 points 3 months ago (2 children)

Once you installed steam you should be fine to go for the most part. Installation is however more like an enable in the configuration.nix

I recommend protontricks and protonupQ.

Then most should work. If you have a Linux game that you don't want to run through steam you can use the steamRun command in nixos if it has issues finding libs.

I haven't tested lutris and the hero launcher though.

However running epicgames through steam works fine.

[โ€“] [email protected] 7 points 3 months ago (1 children)

(This experience isn't via NixOS)

If you get Heroic or Lutris, don't even need to bother with launching Epic or Gog through Steam. In my experience, they link up just fine, and Heroic even has a built-in menu option to add games to Steam.

[โ€“] [email protected] 3 points 3 months ago (1 children)

The advantage of running the ugly epic games launcher is saved games over different machines.

Heroic launcher seems not to save those.

[โ€“] [email protected] 4 points 3 months ago

There's an option to do just that per game. It's set to manual by default to prevent a bad sync, but I haven't had any issues.

[โ€“] [email protected] 1 points 3 months ago

Thanks it's reassuring to know ! I mostly use steam, lutris and minigalaxy (better DLC management than lutris for gog games) so it will be nice if I can keep them ๐Ÿ™‚ I didn't know protontricks so thanks for the recommendation !

[โ€“] qqq 6 points 3 months ago

I haven't tried it out yet for some reason, but I'd start here https://youtu.be/qlfm3MEbqYA

[โ€“] Corbin 3 points 3 months ago (1 children)

Search the manual for support32Bit configuration options, like hardware.opengl.support32Bit, hardware.pulseaudio.support32Bit, or services.pipewire.alsa.support32Bit. Any 32-bit games, as well as Steam itself, will need these to get their GL and PA/ALSA libraries set up properly.

You may also want to look up what programs.nix-ld.enable does, although I hear that there's a better harness builtin as of NixOS 24.05.

All that said, everything Just Worked when I last tried. I haven't run Steam in a while, though. I do use Retroarch and OBS without problems, though, streaming PS4 speedruns to Youtube or Peertube, and that all works out-of-box.

[โ€“] [email protected] 3 points 3 months ago

Thanks for the tip I always forget about the 32 bit thing and then wonder why stuff doesn't work ๐Ÿ˜…

[โ€“] tatterdemalion 3 points 3 months ago (1 children)

Works pretty well for me. I just have this config:

  # Sadly we can't easily install steam on a per-user basis, because installation
  # requires touching a lot of system libraries, etc.
  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
    dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  };

I'm using Sway on an Nvidia RTX 4080 Super. It's important to be on the latest driver. I'm still waiting for Sway to merge support for DRM explicit sync objects, but until then, gaming still works fine with the occasional artifacts from lack of synchronization with the kernel.

If by chance you need a specific Nvidia driver, you can configure that like so:

  hardware.graphics.enable = true;
  hardware.nvidia = {
    package = config.boot.kernelPackages.nvidiaPackages.stable;

    # More versions readily available for downgrading.
    # package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    #   version = "535.154.05";
    #   sha256_64bit = "sha256-fpUGXKprgt6SYRDxSCemGXLrEsIA6GOinp+0eGbqqJg=";
    #   sha256_aarch64 = "sha256-G0/GiObf/BZMkzzET8HQjdIcvCSqB1uhsinro2HLK9k=";
    #   openSha256 = "sha256-wvRdHguGLxS0mR06P5Qi++pDJBCF8pJ8hr4T8O6TJIo=";
    #   settingsSha256 = "sha256-9wqoDEWY4I7weWW05F4igj1Gj9wjHsREFMztfEmqm10=";
    #   persistencedSha256 = "sha256-d0Q3Lk80JqkS1B54Mahu2yY/WocOqFFbZVBh+ToGhaE=";
    # };
    # package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    #   version = "550.40.07";
    #   sha256_64bit = "sha256-KYk2xye37v7ZW7h+uNJM/u8fNf7KyGTZjiaU03dJpK0=";
    #   sha256_aarch64 = "sha256-AV7KgRXYaQGBFl7zuRcfnTGr8rS5n13nGUIe3mJTXb4=";
    #   openSha256 = "sha256-mRUTEWVsbjq+psVe+kAT6MjyZuLkG2yRDxCMvDJRL1I=";
    #   settingsSha256 = "sha256-c30AQa4g4a1EHmaEu1yc05oqY01y+IusbBuq+P6rMCs=";
    #   persistencedSha256 = "sha256-11tLSY8uUIl4X/roNnxf5yS2PQvHvoNjnd2CB67e870=";
    # };

    modesetting.enable = true;
    nvidiaSettings = true;
  };

  # Weird that "xserver" is here when we are using Wayland. But this is required
  # to install the NVIDIA driver.
  services.xserver.videoDrivers = [ "nvidia" ];
[โ€“] [email protected] 2 points 3 months ago

Thanks a lot ! I'll try it when my gaming computer is repaired ๐Ÿ˜€ I'm on a laptop with an intel GPU in the meantime so hopefully it will be easier

[โ€“] [email protected] 1 points 3 months ago* (last edited 3 months ago) (2 children)

Some games don't work, despite what ProtonDB says, such as Stardew Valley.

[โ€“] [email protected] 2 points 3 months ago (1 children)

I've played Stardew with no configuration on my NixOS install a few times before, I think you might have something else going on there?

[โ€“] [email protected] 2 points 3 months ago (1 children)
[โ€“] [email protected] 2 points 3 months ago* (last edited 3 months ago) (1 children)

Interesting.... I've just been pressing the "play" button on Steam ๐Ÿค” Let me do some digging and see if there's anything weird I might be doing.

Edit: Nope, confirmed, just pressing "play" in Steam using GE-Proton-9-9 works fine. Is there any reason you're running it through nix-shell and steam-run instead of the Steam interface?

[โ€“] [email protected] 2 points 3 months ago (1 children)

Just tried GE-Proton-9-9 and the play button goes to "stop" and then right back to "play". I tried launching from terminal using nix-shell and steam-run so I could see the error messages when it crashes. Thanks for looking at your setup to see what was going on.

[โ€“] [email protected] 2 points 3 months ago (1 children)

Interesting, so it just crashes outright? Might I ask what your hardware is like?

[โ€“] [email protected] 1 points 3 months ago (1 children)

It's a 2013 macbook air, which is weird because when I had OSX installed it played Stardew fine.

[โ€“] [email protected] 2 points 3 months ago (1 children)

Huh, yeah that's really weird. Intel device, no Nvidia, capable enough hardware. Unless there's a hardware module for your device that that you haven't enabled in your configuration.nix (I had to do one on my Framework for a few things to work properly), I don't know why that wouldn't be working for you. Out of interest, how did you install steam? Is it in your environment.systemPackages, or did you enable it with packages.steam.enable = true; (or whatever it is)

[โ€“] [email protected] 2 points 3 months ago

I did both - I have steam and steam-run in environment.systemPackages and I have packages.steam.enable = true;

Here's my hardware config:

  hardware = {
    bluetooth.enable = true; # enables support for Bluetooth
    bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
    opengl = {
      enable = true;
      extraPackages = with pkgs; [
        intel-media-driver # LIBVA_DRIVER_NAME=iHD
        intel-media-sdk
        intel-vaapi-driver # For older processors. LIBVA_DRIVER_NAME=i965
        vaapiIntel
        vaapiVdpau
        libvdpau-va-gl
      ];
    };
    pulseaudio = {
      enable = true;
      support32Bit = true;
      extraConfig = "load-module module-combine-sink";
    };
    xpadneo.enable = true;
  };
[โ€“] [email protected] 1 points 3 months ago

In my case I had zero problems with Stardew Valley. Moded or otherwise. Dunno what could be causing it.