nixpkgs/doc/builders/packages/steam.section.md
Jan Tojnar 6ecc641d08
doc: prepare for commonmark
We are still using Pandoc’s Markdown parser, which differs from CommonMark spec slightly.

Notably:
- Line breaks in lists behave differently.
- Admonitions do not support the simpler syntax https://github.com/jgm/commonmark-hs/issues/75
- The auto_identifiers uses a different algorithm – I made the previous ones explicit.
- Languages (classes) of code blocks cannot contain whitespace so we have to use “pycon” alias instead of Python “console” as GitHub’s linguist

While at it, I also fixed the following issues:
- ShellSesssion was used
- Removed some pointless docbook tags.
2021-06-07 06:34:59 +02:00

2.6 KiB

Steam

Steam in Nix

Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin. 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.

Nix problems and constraints:

  • We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python.
  • We don't have the dynamic loader in /lib.
  • The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam.
  • The steam binary cannot be patched, it's also checked.

The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. 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.

How to play

Use programs.steam.enable = true; if you want to add steam to systemPackages and also enable a few workarrounds aswell as Steam controller support or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pr.

Troubleshooting

  • Steam fails to start. What do I do?

    Try to run

    strace steam
    

    to see what is causing steam to fail.

  • Using the FOSS Radeon or nouveau (nvidia) drivers

    • The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore.

    • 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

      steam.sh: line 713: 7842 Segmentation fault (core dumped)
      

      have a look at this pull request.

  • Java

    1. There is no java in steam chrootenv by default. If you get a message like
    /home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found
    

    you need to add

    steam.override { withJava = true; };
    

steam-run

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

pkgs.steam.override ({
  nativeOnly = true;
  newStdcpp = true;
}).run

to your configuration, rebuild, and run the game with

steam-run ./foo