Steam: Difference between revisions

imported>Davidak
No edit summary
imported>Cx405
update, everything tested
Line 1: Line 1:
This page is intended to explain how to run Steam, Steam games as well as proprietary DRM-free games under NixOS.


This page is intended to describe the current state of Steam under NixOS.
== Prerequisites ==
If you are using 64-bit system and plan to also run 32-bit code (some games are 32-bit only) - add <syntaxhighlight lang="nix" inline>hardware.opengl.driSupport32Bit = true</syntaxhighlight> and <syntaxhighlight lang="nix" inline>hardware.pulseaudio.support32Bit = true</syntaxhighlight> (in case you are using pulseaudio) to your configuration.


== I want to play ==
Example snippet of <code>configuration.nix</code>:
For 64-bit systems it's important to have <syntaxhighlight lang="nix" inline>hardware.opengl.driSupport32Bit = true</syntaxhighlight> in your NixOS configuration. You'll also need <syntaxhighlight lang="nix" inline>hardware.pulseaudio.support32Bit = true</syntaxhighlight> if you are using PulseAudio - this will enable 32bit ALSA apps integration.
<syntaxHighlight lang=nix>
  ...
  hardware.opengl.driSupport32Bit = true;
  hardware.pulseaudio.support32Bit = true;
  ...
</syntaxHighlight>
 
== Installation ==
Several installation options exist.
 
=== Pure steam client ===
If you need Steam client, install it with<syntaxhighlight lang="nix" inline>steam</syntaxhighlight> package.
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
  environment.systemPackages = with pkgs; [
  ...
  steam
  ];
  ...
</syntaxHighlight>
 
=== 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 <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
  environment.systemPackages = with pkgs; [
  ...
  (steam.override { nativeOnly = true; })
];
  ...
</syntaxHighlight>
 
=== 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 either<syntaxhighlight lang="nix" inline>steam-run</syntaxhighlight> or <syntaxhighlight lang="nix" inline>steam-run-native</syntaxhighlight>. The native version may work better for DRM-free standalone games.
 
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
  ...
  environment.systemPackages = with pkgs; [
  ...
  steam-run-native
  ];
  ...
</syntaxHighlight>
 
Other option, in case you need more flexibility, is to directly reference to the part of steam metapackage instead. In fact, <code>steam-run-native</code> above is just a wrapper linking to <code>steam.run</code>.
 
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
  ...
  environment.systemPackages = with pkgs; [
  ...
  (steam.override { nativeOnly = true; }).run
  ];
  ...
</syntaxHighlight>
This builds same result as <code>steam-run-native</code> above.
 
Install the game by setting the executable attribute on the installer and then running it via <code>steam-run ./your_gog_installer.sh</code>. After installation, edit the "~/.local/share/applications/your_game_here.desktop" and replace the exec line from <code>Exec="/home/user/game/start.sh" ""</code> with <code>Exec="steam-run" "/home/user/game/start.sh"</code>.


For detection of controllers and VR Headsets like HTC Vive and Valve Index, you have to enable udev rules with <syntaxhighlight lang="nix" inline>hardware.steam-hardware.enable = true</syntaxhighlight>.
== Adding missing dependencies ==


In short, add this to your <code>configuration.nix</code>
This is can be done this way:
<syntaxHighlight lang=nix>
  ...
  environment.systemPackages = with pkgs; [
  ...
  (steam.override { extraPkgs = pkgs: [ mono gtk3 gtk3-x11 libgdiplus zlib ]; nativeOnly = true; }).run
  ];
...
</syntaxHighlight>
 
=== Java ===
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
  ...
programs.java.enable = true;
environment.systemPackages = with pkgs; [
  ...
(steam.override { withJava = true; })
];
  ...
</syntaxHighlight>
 
You can test java availability by invoking chrooted bash instance: <code>steam-run bash</code> and then typing: <code>java -version</code>. Can be combined with extra packages above.
 
== Limit user access ==
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{
   ...
   ...
   users.users.<your-username>.packages = [
   users.users.<your-username>.packages = [
     pkgs.steam
     pkgs.steam
   ];
   ];
  hardware.opengl.driSupport32Bit = true;
...
  hardware.pulseaudio.support32Bit = true;
  hardware.steam-hardware.enable = true;
}
</syntaxHighlight>
</syntaxHighlight>
{{tip|Install "steam" package. Run "steam". Many of the games will just work.}}


== Troubleshooting ==
== Troubleshooting ==
I was sure you would reach this part.


=== Steam fails to start. What do I do? ===
=== Steam fails to start. What do I do? ===
strace is your friend.
strace then open bug report.


=== Game X fails to start ===
=== 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:
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
* Patch the script/binary if you can
Line 53: Line 133:


=== Known issues ===
=== Known issues ===
# No java in steam chrootenv. Games affected: Towns:
"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 <code>steam-run bash</code>.
<syntaxhighlight lang="console">
/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found
</syntaxhighlight>


=== HiDPI ===
=== HiDPI ===
If you're blessed with a higher DPI monitor, Steam's UI fonts may be unbearably tiny. You can add a custom skin from https://github.com/MoriTanosuke/HiDPI-Steam-Skin for your user to alleviate this. The skins directory is ~/.local/share/Steam/skins/.
If Steam's UI fonts are unbearably tiny, consider adding a custom skin from https://github.com/MoriTanosuke/HiDPI-Steam-Skin for your user to alleviate this. The skins directory is ~/.local/share/Steam/skins/.


== steam-run ==
== steam-run ==
<code>steam-run</code> 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 <code>steam-run</code>. Before trying other solutions, try starting your game this way, where <code>start-game.sh</code> is the script used to start the game on Linux.
<code>steam-run</code> 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 <code>steam-run</code>. Before trying other solutions, try starting your game this way, where <code>start-game.sh</code> is the script used to start the game on Linux.