Steam: Difference between revisions

From NixOS Wiki
imported>Cx405
No edit summary
m environment.systemPackages is a list of packages
 
(81 intermediate revisions by 48 users not shown)
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.
{{Expansion|See notes in ->}}


== Prerequisites ==
This page is intended to explain how to run [[Steam]], [[Steam]] games as well as proprietary DRM-free games under NixOS.
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.
Steam on NixOS is very easy to install and use - it just works. But you may need to be aware of the limitations when trying to run a native Linux install of a game. It's often better to run the emulated Windows version via [https://en.m.wikipedia.org/wiki/Proton_(software) Proton].
A dedicated [[Games]] page lists games and reports on their successful execution on NixOS.  


Example snippet of <code>configuration.nix</code>:
== Install ==
 
To install the [[Steam]] package and enable all the system options necessary to allow it to run:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
# There have been amdgpu issues in 6.10 so you maybe need to revert on the default lts kernel.
# boot.kernelPackages = pkgs.linuxPackages;
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
};
</nowiki>}}
 
[https://news.ycombinator.com/item?id=41549030 Anecdata on 6.10 issues]
 
 
 
{{note|Enabling [[steam]] installs several unfree packages. If you are using <code>allowUnfreePredicate</code> you will need to ensure that your configurations permit all of them.
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
   ...
{
  hardware.opengl.driSupport32Bit = true;
   nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
   hardware.pulseaudio.support32Bit = true;
    "steam"
  ...
    "steam-unwrapped"
    "steam-original"
    "steam-run"
   ];
}
</syntaxHighlight>
</syntaxHighlight>
}}
=== Gamescope Compositor / "Boot to Steam Deck" ===
Gamescope can function as a minimal desktop environment, meaning you can launch it from a TTY and have an experience very similar to the Steam Deck hardware console.


== Installation ==
<syntaxhighlight lang="nix">
Several installation options exist.


=== Pure steam client ===
programs = {
If you need Steam client, install it with<syntaxhighlight lang="nix" inline>steam</syntaxhighlight> package.
  gamescope = {
Example snippet of <code>configuration.nix</code>:
    enable = true;
<syntaxHighlight lang=nix>
    capSysNice = true;
  environment.systemPackages = with pkgs; [
  };
  ...
  steam = {
  steam
    enable = true;
  ];
    gamescopeSession.enable = true;
  ...
  };
};
hardware.xone.enable = true; # support for the xbox controller USB dongle
services.getty.autologinUser = "your_user";
environment = {
  systemPackages = [ pkgs.mangohud ];
  loginShellInit = ''
    [[ "$(tty)" = "/dev/tty1" ]] && ./gs.sh
  '';
};
</syntaxhighlight>
 
==== gs.sh ====
<syntaxHighlight lang=bash>
#!/usr/bin/env bash
set -xeuo pipefail
 
gamescopeArgs=(
    --adaptive-sync # VRR support
    --hdr-enabled
    --mangoapp # performance overlay
    --rt
    --steam
)
steamArgs=(
    -pipewire-dmabuf
    -tenfoot
)
mangoConfig=(
    cpu_temp
    gpu_temp
    ram
    vram
)
mangoVars=(
    MANGOHUD=1
    MANGOHUD_CONFIG="$(IFS=,; echo "${mangoConfig[*]}")"
)
 
export "${mangoVars[@]}"
exec gamescope "${gamescopeArgs[@]}" -- steam "${steamArgs[@]}"
</syntaxHighlight>
</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.
=== steam-tui ===
Example snippet of <code>configuration.nix</code>:
If you want the steam-tui client you'll have to install it, but since it relies on <code>steamcmd</code> being set up, you'll have to set that up, just to generate the right files.
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
  environment.systemPackages = with pkgs; [
nix-shell -p steamcmd --run steamcmd
  ...
  (steam.override { nativeOnly = true; })
];
  ...
</syntaxHighlight>
</syntaxHighlight>
And then log in: <syntaxHighlight>login <username> <password> <steam 2fa password></syntaxHighlight>
After that, steam-tui should start fine.


=== FHS environment only (aka GOG/Humble) ===
=== FHS environment only ===
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.
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 games downloaded from the internet.


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.
Note that this is not necessary for clients installed from Nixpkgs (like Minigalaxy or Itch), which already use the FHS environment.
 
There are two options to install the FHS environment. The first is to install <syntaxhighlight lang="nix" inline>steam-run</syntaxhighlight>.


Example snippet of <code>configuration.nix</code>:
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
  ...
   environment.systemPackages = with pkgs; [
   environment.systemPackages = with pkgs; [
  ...
    steam-run
  steam-run-native
   ];
   ];
  ...
</syntaxHighlight>
</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>.
Another option, in case you need more flexibility, is to directly reference the part of [[steam]] metapackage.


Example snippet of <code>configuration.nix</code>:
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
  ...
   environment.systemPackages = with pkgs; [
   environment.systemPackages = with pkgs; [
  ...
    (steam.override { /* Your overrides here */ }).run
  (steam.override { nativeOnly = true; }).run
   ];
   ];
  ...
</syntaxHighlight>
</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>.
Install the game by setting the executable attribute on the installer and then running it via <code>steam-run ./your_installer.sh</code>. After installation, edit the "~/.local/share/applications/your_game.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>.


== Adding missing dependencies ==
== Adding missing dependencies ==


This can be done this way:
In some cases, you may need to override [[steam]] to provide missing dependencies.
<syntaxHighlight lang=nix>
Use the <code>programs.steam.package</code> for this.
  ...
  environment.systemPackages = with pkgs; [
  ...
  (steam.override { extraPkgs = pkgs: [ mono gtk3 gtk3-x11 libgdiplus zlib ]; nativeOnly = true; }).run
  ];
...
</syntaxHighlight>


=== Bumblebee and Primus ===
=== Bumblebee and Primus ===
This can be done this way:
<syntaxhighlight lang="nix">
<syntaxHighlight lang=nix>
   programs.steam.package = pkgs.steam.override {
   ...
    withPrimus = true;
  environment.systemPackages = with pkgs; [
    extraPackages = [ bumblebee glxinfo ];
  ...
   };
  (steam.override { withPrimus = true; extraPkgs = pkgs: [ bumblebee glxinfo ]; nativeOnly = true; }).run
</syntaxhighlight>
   ];
...
</syntaxHighlight>


=== Java ===
=== Java ===
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
   ...
   programs.java.enable = true;  
programs.java.enable = true;  
  programs.steam.package = pkgs.steam.override { withJava = true; };
environment.systemPackages = with pkgs; [
  ...
(steam.override { withJava = true; })
];
  ...
</syntaxHighlight>
</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.
== gamescope ==
 
To use the [https://github.com/ValveSoftware/gamescope gamescope] compositor, which enables features such as resolution upscaling and stretched aspect ratios (such as 4:3), set


== Limit user access ==
Example snippet of <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
  ...
programs.steam.gamescopeSession.enable = true;
  users.users.<your-username>.packages = [
    pkgs.steam
  ];
...
</syntaxHighlight>
</syntaxHighlight>
in your system configuration.


== Troubleshooting ==
== Troubleshooting ==
For all issues: first run <code>steam -dev -console</code> through the terminal and read the output.


=== Steam fails to start. What do I do? ===
=== Steam fails to start. What do I do? ===
strace then open bug report.
Run <code>strace steam -dev -console 2> steam.logs</code> in the terminal. In the case of a missing <code>strace</code> installation, you can temporarily install it using <code>nix-shell -p strace</code> or <code>nix run nixpkgs#strace -- steam -dev -console 2> steam.logs</code>, if [[Flakes]] are enabled. After that, create a bug report. <!-- This is vague. Where should the user create a bug report?  -->
 
=== Steam is not updated ===
 
When you restart [[Steam]] after an update, it starts the old version. ([https://github.com/NixOS/nixpkgs/issues/181904 #181904])
 
A workaround is to remove the user files in <code>/home/<USER>/.local/share/Steam/userdata</code>. This can be done with <code>rm -rf /home/<USER>/.local/share/Steam/userdata</code> in the terminal or with your file manager. After that, Steam can be setup again by restarting.


=== Game fails to start ===
=== Game fails to start ===
Line 125: Line 174:
* Using the LD_LIBRARY_PATH from the nix/store steam script, with some additions, launch the game binary
* Using the LD_LIBRARY_PATH from the nix/store steam script, with some additions, launch the game binary
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
  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)
  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 parameter)
</syntaxhighlight>
 
Note: If a game gets stuck on Installing scripts, check for a DXSETUP.EXE process and run it manually, then restart the game launch.
 
==== Changing the driver on AMD GPUs <!-- this is not recommended due radv drivers performing better and generally more stable than amdvlk. My suggestion remove this section. source: https://forums.guru3d.com/threads/the-mesa-radv-amdvlk-thread.449774/ -->====
{{note|This is not recommended because radv drivers tend to perform better and are generally more stable than amdvlk.}}
 
Sometimes, changing the driver on AMD GPUs helps. To try this, first, install multiple drivers such as radv and amdvlk:
 
<syntaxHighlight lang=nix>
hardware.graphics = { # hardware.opengl in 24.05
  ## radv: an open-source Vulkan driver from freedesktop
  enable32Bit = true; # driSupport32Bit in 24.05
 
  ## amdvlk: an open-source Vulkan driver from AMD
  extraPackages = [ pkgs.amdvlk ];
  extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
};
</syntaxHighlight>
 
In the presence of both drivers, [[Steam]] will default to amdvlk. The amdvlk driver can be considered more correct regarding Vulkan specification implementation, but less performant than radv. However, this tradeoff between correctness and performance can sometimes make or break the gaming experience.
 
To "reset" your driver to radv when both radv and amdvlk are installed, set either <code>AMD_VULKAN_ICD = "RADV"</code> or <code>VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"</code> environment variable. For example, if you start [[Steam]] from the shell, you can enable radv for the current session by running <code>AMD_VULKAN_ICD="RADV" steam</code>. If you are unsure which driver you currently use, you can launch a game with [https://github.com/flightlessmango/MangoHud MangoHud] enabled, which has the capability to show what driver is currently in use.
 
=== SteamVR ===
 
The setcap issue at SteamVR start can be fixed with:
 
<code>sudo setcap CAP_SYS_NICE+ep ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher</code>
 
=== Gamescope fails to launch when used within Steam ===
Gamescope may fail to start due to missing Xorg libraries. ([https://github.com/NixOS/nixpkgs/issues/214275 #214275]) To resolve this override the steam package to add them:<syntaxhighlight lang="nix">
programs.steam.package = pkgs.steam.override {
  extraPkgs = pkgs:
    with pkgs; [
      xorg.libXcursor
      xorg.libXi
      xorg.libXinerama
      xorg.libXScrnSaver
      libpng
      libpulseaudio
      libvorbis
      stdenv.cc.cc.lib
      libkrb5
      keyutils
    ];
};
</syntaxhighlight>
</syntaxhighlight>
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.


=== new Libcpp for steam ===
=== Known issues ===
{{outdated|Since the merge of {{issue|29180}} this subsection is obsolete}}
"Project Zomboid" may report "couldn't determine 32/64 bit of java". This is not related to java at all, it carries its own outdated java binary that refuses to start if path contains non-Latin characters. Check for errors by directly starting local java binary within <code>steam-run bash</code>.
The open source radeon drivers need a newer libc++ than is provided by the default runtime, which leads to acrash on launch. Use
 
Resetting your password through the [[Steam]] app may fail at the CAPTCHA step repeatedly, with [[Steam]] itself reporting that the CAPTCHA was not correct, even though the CAPTCHA UI shows success. Resetting password through the [[Steam]] website should work around that.
 
== Steam hardware ==
If you are using a Steam Controller or a Valve Index, you will want to add <code>hardware.steam-hardware.enable = true;</code> to your configuration.
 
Note that this is already enabled with <code>programs.steam.enable = true;</code>.
 
 
 
== Proton ==
 
=== NixOS 21.11 ===
 
From NixOS 21.11 onwards, you should be able to play most games with Proton. If there is a Linux native version you have to activate a custom compatibility layer to use the emulated Windows version. Native Linux versions may not even start due to the way NixOS work.
 
=== Custom Proton versions ===
 
By default, [[Steam]] looks for custom Proton versions such as GE-Proton in <code>~/.steam/root/compatibilitytools.d</code>. Additionally the environment variable <code>STEAM_EXTRA_COMPAT_TOOLS_PATHS</code> can be set to change or add to the paths which [[steam]] searches for custom Proton versions.
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
(steamPackages.override { newLibcpp = true; }).steam-chrootenv
programs.steam.extraCompatPackages = with pkgs; [ proton-ge-bin ];
</syntaxhighlight>
</syntaxhighlight>
[https://github.com/NixOS/nixpkgs/pull/12404 in your config] if you get an error like


libGL error: unable to load driver: radeonsi_dri.so
=== Install Proton versions by GUI ===
libGL error: driver pointer missing
The main disadvantage of using the proton-ge-bin package is: its only one version. For using steam it may be better not to use the declaritive approach and manually install several versions of proton via protonup-qt GUI (like GloriousEggroll version GE_Proton).
libGL error: failed to load driver: radeonsi
<syntaxHighlight lang=nix>
libGL error: unable to load driver: swrast_dri.so
  environment.systemPackages = with pkgs; [
libGL error: failed to load driver: swrast
    protonup-qt
  ];
</syntaxHighlight>


=== Known issues ===
== GameMode ==
"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>.
Consider activating [[GameMode]].


=== HiDPI ===
== See also ==
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/.
[[Explaining the current Steam Package build]]


== steam-run ==
[[VR]]
<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.


<syntaxhighlight lang="commands">
[[Category:Applications]]
$ steam-run ./start-game.sh
[[Category:Gaming]]
</syntaxhighlight>

Latest revision as of 12:00, 4 November 2024

This page is intended to explain how to run Steam, Steam games as well as proprietary DRM-free games under NixOS. Steam on NixOS is very easy to install and use - it just works. But you may need to be aware of the limitations when trying to run a native Linux install of a game. It's often better to run the emulated Windows version via Proton. A dedicated Games page lists games and reports on their successful execution on NixOS.

Install

To install the Steam package and enable all the system options necessary to allow it to run:

/etc/nixos/configuration.nix
# There have been amdgpu issues in 6.10 so you maybe need to revert on the default lts kernel.
# boot.kernelPackages = pkgs.linuxPackages;
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
};

Anecdata on 6.10 issues


Note: Enabling steam installs several unfree packages. If you are using allowUnfreePredicate you will need to ensure that your configurations permit all of them.
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "steam"
    "steam-unwrapped"
    "steam-original"
    "steam-run"
  ];
}

Gamescope Compositor / "Boot to Steam Deck"

Gamescope can function as a minimal desktop environment, meaning you can launch it from a TTY and have an experience very similar to the Steam Deck hardware console.

programs = {
  gamescope = {
    enable = true;
    capSysNice = true;
  };
  steam = {
    enable = true;
    gamescopeSession.enable = true;
  };
};
hardware.xone.enable = true; # support for the xbox controller USB dongle
services.getty.autologinUser = "your_user";
environment = {
  systemPackages = [ pkgs.mangohud ];
  loginShellInit = ''
    [[ "$(tty)" = "/dev/tty1" ]] && ./gs.sh
  '';
};

gs.sh

#!/usr/bin/env bash
set -xeuo pipefail

gamescopeArgs=(
    --adaptive-sync # VRR support
    --hdr-enabled
    --mangoapp # performance overlay
    --rt
    --steam
)
steamArgs=(
    -pipewire-dmabuf
    -tenfoot
)
mangoConfig=(
    cpu_temp
    gpu_temp
    ram
    vram
)
mangoVars=(
    MANGOHUD=1
    MANGOHUD_CONFIG="$(IFS=,; echo "${mangoConfig[*]}")"
)

export "${mangoVars[@]}"
exec gamescope "${gamescopeArgs[@]}" -- steam "${steamArgs[@]}"


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 2fa password>

After that, steam-tui should start fine.

FHS environment only

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 games downloaded from the internet.

Note that this is not necessary for clients installed from Nixpkgs (like Minigalaxy or Itch), which already use the FHS environment.

There are two options to install the FHS environment. The first is to install steam-run.

Example snippet of configuration.nix:

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

Another option, in case you need more flexibility, is to directly reference the part of steam metapackage.

Example snippet of configuration.nix:

  environment.systemPackages = with pkgs; [
    (steam.override { /* Your overrides here */ }).run
  ];

Install the game by setting the executable attribute on the installer and then running it via steam-run ./your_installer.sh. After installation, edit the "~/.local/share/applications/your_game.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

In some cases, you may need to override steam to provide missing dependencies. Use the programs.steam.package for this.

Bumblebee and Primus

  programs.steam.package = pkgs.steam.override {
     withPrimus = true;
     extraPackages = [ bumblebee glxinfo ];
  };

Java

  programs.java.enable = true; 
  programs.steam.package = pkgs.steam.override { withJava = true; };

gamescope

To use the gamescope compositor, which enables features such as resolution upscaling and stretched aspect ratios (such as 4:3), set

programs.steam.gamescopeSession.enable = true;

in your system configuration.

Troubleshooting

For all issues: first run steam -dev -console through the terminal and read the output.

Steam fails to start. What do I do?

Run strace steam -dev -console 2> steam.logs in the terminal. In the case of a missing strace installation, you can temporarily install it using nix-shell -p strace or nix run nixpkgs#strace -- steam -dev -console 2> steam.logs, if Flakes are enabled. After that, create a bug report.

Steam is not updated

When you restart Steam after an update, it starts the old version. (#181904)

A workaround is to remove the user files in /home/<USER>/.local/share/Steam/userdata. This can be done with rm -rf /home/<USER>/.local/share/Steam/userdata in the terminal or with your file manager. After that, Steam can be setup again by restarting.

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 parameter)

Note: If a game gets stuck on Installing scripts, check for a DXSETUP.EXE process and run it manually, then restart the game launch.

Changing the driver on AMD GPUs

Note: This is not recommended because radv drivers tend to perform better and are generally more stable than amdvlk.

Sometimes, changing the driver on AMD GPUs helps. To try this, first, install multiple drivers such as radv and amdvlk:

hardware.graphics = { # hardware.opengl in 24.05
  ## radv: an open-source Vulkan driver from freedesktop
  enable32Bit = true; # driSupport32Bit in 24.05

  ## amdvlk: an open-source Vulkan driver from AMD
  extraPackages = [ pkgs.amdvlk ];
  extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
};

In the presence of both drivers, Steam will default to amdvlk. The amdvlk driver can be considered more correct regarding Vulkan specification implementation, but less performant than radv. However, this tradeoff between correctness and performance can sometimes make or break the gaming experience.

To "reset" your driver to radv when both radv and amdvlk are installed, set either AMD_VULKAN_ICD = "RADV" or VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json" environment variable. For example, if you start Steam from the shell, you can enable radv for the current session by running AMD_VULKAN_ICD="RADV" steam. If you are unsure which driver you currently use, you can launch a game with MangoHud enabled, which has the capability to show what driver is currently in use.

SteamVR

The setcap issue at SteamVR start can be fixed with:

sudo setcap CAP_SYS_NICE+ep ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher

Gamescope fails to launch when used within Steam

Gamescope may fail to start due to missing Xorg libraries. (#214275) To resolve this override the steam package to add them:

programs.steam.package = pkgs.steam.override {
  extraPkgs = pkgs:
    with pkgs; [
      xorg.libXcursor
      xorg.libXi
      xorg.libXinerama
      xorg.libXScrnSaver
      libpng
      libpulseaudio
      libvorbis
      stdenv.cc.cc.lib
      libkrb5
      keyutils
    ];
};

Known issues

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

Resetting your password through the Steam app may fail at the CAPTCHA step repeatedly, with Steam itself reporting that the CAPTCHA was not correct, even though the CAPTCHA UI shows success. Resetting password through the Steam website should work around that.

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 configuration.

Note that this is already enabled with programs.steam.enable = true;.


Proton

NixOS 21.11

From NixOS 21.11 onwards, you should be able to play most games with Proton. If there is a Linux native version you have to activate a custom compatibility layer to use the emulated Windows version. Native Linux versions may not even start due to the way NixOS work.

Custom Proton versions

By default, Steam looks for custom Proton versions such as GE-Proton in ~/.steam/root/compatibilitytools.d. Additionally the environment variable STEAM_EXTRA_COMPAT_TOOLS_PATHS can be set to change or add to the paths which steam searches for custom Proton versions.

programs.steam.extraCompatPackages = with pkgs; [ proton-ge-bin ];

Install Proton versions by GUI

The main disadvantage of using the proton-ge-bin package is: its only one version. For using steam it may be better not to use the declaritive approach and manually install several versions of proton via protonup-qt GUI (like GloriousEggroll version GE_Proton).

  environment.systemPackages = with pkgs; [
    protonup-qt
  ];

GameMode

Consider activating GameMode.

See also

Explaining the current Steam Package build

VR