2019-10-20 12:14:30 +01:00
<section xmlns= "http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="sec-steam">
2019-10-30 10:03:55 +00:00
<title > Steam</title>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<section xml:id= "sec-steam-nix" >
<title > Steam in Nix</title>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
Steam is distributed as a <filename > .deb</filename> file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called <filename > steam</filename> that in Ubuntu (their target distro) would go to <filename > /usr/bin </filename> . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME.
</para>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
Nix problems and constraints:
<itemizedlist >
<listitem >
<para >
We don't have <filename > /bin/bash</filename> and many scripts point there. Similarly for <filename > /usr/bin/python</filename> .
</para>
</listitem>
<listitem >
<para >
We don't have the dynamic loader in <filename > /lib </filename> .
</para>
</listitem>
<listitem >
<para >
The <filename > steam.sh</filename> script in $HOME can not be patched, as it is checked and rewritten by steam.
</para>
</listitem>
<listitem >
<para >
The steam binary cannot be patched, it's also checked.
</para>
</listitem>
</itemizedlist>
</para>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented <link xlink:href= "http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html" > here</link> . This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment.
</para>
</section>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<section xml:id= "sec-steam-play" >
<title > How to play</title>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
For 64-bit systems it's important to have
2019-10-20 12:14:30 +01:00
<programlisting > hardware.opengl.driSupport32Bit = true;</programlisting>
2019-10-30 10:03:55 +00:00
in your <filename > /etc/nixos/configuration.nix</filename> . You'll also need
2019-10-20 12:14:30 +01:00
<programlisting > hardware.pulseaudio.support32Bit = true;</programlisting>
2019-10-30 10:03:55 +00:00
if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add
2019-10-20 12:14:30 +01:00
<programlisting > hardware.steam-hardware.enable = true;</programlisting>
2019-10-30 10:03:55 +00:00
to your configuration.
</para>
</section>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<section xml:id= "sec-steam-troub" >
<title > Troubleshooting</title>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
<variablelist >
<varlistentry >
<term >
Steam fails to start. What do I do?
</term>
<listitem >
<para >
Try to run
2019-10-20 12:14:30 +01:00
<programlisting > strace steam</programlisting>
2019-10-30 10:03:55 +00:00
to see what is causing steam to fail.
</para>
</listitem>
</varlistentry>
<varlistentry >
<term >
Using the FOSS Radeon or nouveau (nvidia) drivers
</term>
<listitem >
<itemizedlist >
<listitem >
<para >
The <literal > newStdcpp</literal> parameter was removed since NixOS 17.09 and should not be needed anymore.
</para>
</listitem>
<listitem >
<para >
Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error
2019-10-20 12:14:30 +01:00
<programlisting > steam.sh: line 713: 7842 Segmentation fault (core dumped)</programlisting>
2019-10-30 10:03:55 +00:00
have a look at <link xlink:href= "https://github.com/NixOS/nixpkgs/pull/20269" > this pull request</link> .
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry >
<term >
Java
</term>
<listitem >
<orderedlist >
<listitem >
<para >
There is no java in steam chrootenv by default. If you get a message like
2019-10-20 12:14:30 +01:00
<programlisting > /home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found</programlisting>
2019-10-30 10:03:55 +00:00
You need to add
2019-10-20 12:14:30 +01:00
<programlisting > steam.override { withJava = true; };</programlisting>
2019-10-30 10:03:55 +00:00
to your configuration.
</para>
</listitem>
</orderedlist>
</listitem>
</varlistentry>
</variablelist>
</para>
</section>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<section xml:id= "sec-steam-run" >
<title > steam-run</title>
2019-10-20 12:14:30 +01:00
2019-10-30 10:03:55 +00:00
<para >
The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add
2019-10-20 12:14:30 +01:00
<programlisting > pkgs.(steam.override {
nativeOnly = true;
newStdcpp = true;
}).run</programlisting>
2019-10-30 10:03:55 +00:00
to your configuration, rebuild, and run the game with
2019-10-20 12:14:30 +01:00
<programlisting > steam-run ./foo</programlisting>
2019-10-30 10:03:55 +00:00
</para>
</section>
</section>