Steam: Difference between revisions

From NixOS Wiki
imported>Flexagoon
No edit summary
imported>Gytis-ivaskevicius
No edit summary
Line 133: Line 133:
== Proton ==
== Proton ==


=== Nixos 20.09 ===
=== Nixos 21.11 (current release) ===


You can play games using proton 5.0 or lower. Versions newer than 5.0 does not seem to work currently.
In this version of nixos, you should be able to play most games with Proton.
 
=== Nixos 21.11 (currently unstable channel) ===
 
In this version of nixos (currently the unstable channel), you should be able to play most games with Proton.

Revision as of 14:47, 27 July 2021

Note: This package is unfree and requires extra steps to install.

This page is intended to explain how to run Steam, Steam games as well as proprietary DRM-free games under NixOS. A dedicated Games page lists games and reports on their successful execution on NixOS.


Installation

Several installation options exist.

Normal install

  programs.steam.enable = true;
Warning: Just adding steam to your package list is not going to work, since it won't enable all necessary system options. Please enable steam as shown above.

Native steam client

If you want Steam client to use NixOS libraries instead of Steam-provided, you need to set an override. Note, that this may be broken. Example snippet of configuration.nix:

  nixpkgs.config.packageOverrides = pkgs: {
    steam = pkgs.steam.override {
      nativeOnly = true;
    };
  };
  programs.steam.enable = true;

steam-tui

If you want the steam-tui client you'll have to install it, but since it relies on `steamcmd` being set up, you'll have to set that up, just to generate the right files.

nix-shell -p steamcmd --run steamcmd

And then log in:

login <username> <password> <steam f2a password>

After that, steam-tui should start fine.

FHS environment only (aka GOG/Humble)

This will only make partial installation - provide the script, which creates the typical environment expected by proprietary games and software on regular Linux, allowing to run such software without patching. Useful if you plan to run GOG or HumbleBundle games.

First option is to install eithersteam-run or steam-run-native. The native version may work better for DRM-free standalone games.

Example snippet of configuration.nix:

  environment.systemPackages = with pkgs; [
    steam-run-native
  ];

unfree Other option, in case you need more flexibility, is to directly reference to the part of steam metapackage instead. In fact, steam-run-native above is just a wrapper linking to steam.run.

Example snippet of configuration.nix:

  environment.systemPackages = with pkgs; [
    (steam.override { nativeOnly = true; }).run
  ];

This builds same result as steam-run-native above.

Install the game by setting the executable attribute on the installer and then running it via steam-run ./your_gog_installer.sh. After installation, edit the "~/.local/share/applications/your_game_here.desktop" and replace the exec line from Exec="/home/user/game/start.sh" "" with Exec="steam-run" "/home/user/game/start.sh".

Adding missing dependencies

may also need nativeOnly = true; but i have not tested

  nixpkgs.config.packageOverrides = pkgs: {
    steam = pkgs.steam.override {
      extraPkgs = pkgs: [
        libgdiplus
      ];
    };
  };

Bumblebee and Primus

  environment.systemPackages = with pkgs; [
    (steam.override {
       withPrimus = true;
       extraPkgs = pkgs: [ bumblebee glxinfo ];
       nativeOnly = true;
    }).run
  ];

Java

  programs.java.enable = true; 
  environment.systemPackages = with pkgs; [
    (steam.override { withJava = true; })
  ];

You can test java availability by invoking chrooted bash instance: steam-run bash and then typing: java -version. Can be combined with extra packages above.

Limit user access

  users.users.<your-username>.packages = [
    pkgs.steam
  ];

Troubleshooting

for all issues: first run steam through the terminal and read the output

Steam fails to start. What do I do?

strace then open bug report.

Game fails to start

Games may fail to start because they lack dependencies (this should be added to the script, for now), or because they cannot be patched. The steps to launch a game directly are:

  • Patch the script/binary if you can
  • Add a file named steam_appid.txt in the binary folder, with the appid as contents (it can be found in the stdout from steam)
  • Using the LD_LIBRARY_PATH from the nix/store steam script, with some additions, launch the game binary
 LD_LIBRARY_PATH=~/.steam/bin32:$LD_LIBRARY_PATH:/nix/store/pfsa... blabla ...curl-7.29.0/lib:. ./Osmos.bin32 (if you could not patchelf the game, call ld.so directly with the binary as param)

With this technique, I can play many games directly from steam. Others, like Team Fortress, cannot be patched so I only managed to run them from the cmd line.

Known issues

"Project Zomboid" may report "couldn't determine 32/64 bit of java". This is not related to java at all, it carries own outdated java binary that refuses to start if path contains non-latein characters. Check for errors by directly starting local java binary within steam-run bash.

steam-run

steam-run is a helper that can be used to run external programs in the steam FHS environment. This means that some third-party software, mostly games, can be run easily on NixOS using steam-run. Before trying other solutions, try starting your game this way, where start-game.sh is the script used to start the game on Linux.

 $ steam-run ./start-game.sh

Steam hardware

If you are using a Steam Controller or a Valve Index, you will want to add hardware.steam-hardware.enable = true; to your configurations.

Proton

Nixos 21.11 (current release)

In this version of nixos, you should be able to play most games with Proton.