Steam/zh: Difference between revisions

Weijia (talk | contribs)
Created page with "== 提示和技巧 =="
FuzzyBot (talk | contribs)
Updating to match new version of source page
 
(16 intermediate revisions by one other user not shown)
Line 65: Line 65:
   dedicatedServer.openFirewall = true; # For Source Dedicated Server hosting
   dedicatedServer.openFirewall = true; # For Source Dedicated Server hosting
   # Other general flags if available can be set here.
   # Other general flags if available can be set here.
  # Tip: For improved gaming performance, you can also enable GameMode:
  # programs.gamemode.enable = true;
};
};
# Tip: For improved gaming performance, you can also enable GameMode:
# programs.gamemode.enable = true;
</syntaxhighlight>
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 78: Line 78:
== 提示和技巧 ==
== 提示和技巧 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Gamescope_Compositor_/_&quot;Boot_to_Steam_Deck&quot;"></span>
=== Gamescope Compositor / "Boot to Steam Deck" ===
=== Gamescope Compositor / "启动至 Steam Deck" ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
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.
Line 87: Line 86:
# Clean Quiet Boot
# Clean Quiet Boot
boot.kernelParams = [ "quiet" "splash" "console=/dev/null" ];
boot.kernelParams = [ "quiet" "splash" "console=/dev/null" ];
plymouth.enable = true;
boot.plymouth.enable = true;


programs.gamescope = {
programs.gamescope = {
Line 103: Line 102:
   settings = {
   settings = {
     default_session = {
     default_session = {
       command = "${pkgs.gamescope}/bin/gamescope -W 1920 -H 1080 -f -e --xwayland-count 2 --hdr-enabled --hdr-itm-enabled -- steam -pipewire-dmabuf -gamepadui -steamos > /dev/null 2>&1";
       command = "${pkgs.gamescope}/bin/gamescope -W 1920 -H 1080 -f -e --xwayland-count 2 --hdr-enabled --hdr-itm-enabled -- steam -pipewire-dmabuf -gamepadui -steamdeck -steamos3 > /dev/null 2>&1";
       user = "USERNAME_HERE";
       user = "USERNAME_HERE";
     };
     };
Line 110: Line 109:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== steam-tui ===
=== steam-tui ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
If you want the steam-tui client, you'll have to install it. It relies on <code>steamcmd</code> being set up, so you'll need to run <code>steamcmd</code> once to generate the necessary configuration files.
If you want the steam-tui client, you'll have to install it. It relies on <code>steamcmd</code> being set up, so you'll need to run <code>steamcmd</code> once to generate the necessary configuration files.
Line 132: Line 129:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="FHS_environment_only"></span>
=== FHS environment only ===
=== FHS 环境 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
To run proprietary games or software downloaded from the internet that expect a typical Linux Filesystem Hierarchy Standard (FHS), you can use <code>steam-run</code>. This provides an FHS-like environment without needing to patch the software.
To run proprietary games or software downloaded from the internet that expect a typical Linux Filesystem Hierarchy Standard (FHS), you can use <code>steam-run</code>. This provides an FHS-like environment without needing to patch the software.
Line 156: Line 152:
];
];
</syntaxhighlight>
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Proton ===
=== Proton ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
You should be able to play most Windows games using Proton. If a game has a native Linux version that causes issues on NixOS, you can force the use of Proton by selecting a specific Proton version in the game's compatibility settings in Steam.
You should be able to play most Windows games using Proton. If a game has a native Linux version that causes issues on NixOS, you can force the use of Proton by selecting a specific Proton version in the game's compatibility settings in Steam.
Line 165: Line 159:
By default, Steam also looks for custom Proton versions in <code>~/.steam/root/compatibilitytools.d</code>. The environment variable <code>STEAM_EXTRA_COMPAT_TOOLS_PATHS</code> can be set to add other search paths.
By default, Steam also looks for custom Proton versions in <code>~/.steam/root/compatibilitytools.d</code>. The environment variable <code>STEAM_EXTRA_COMPAT_TOOLS_PATHS</code> can be set to add other search paths.
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
自定义 Proton 版本的声明式安装(例如 GE-Proton):
Declarative install of custom Proton versions (e.g. GE-Proton):
</div>
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
programs.steam.extraCompatPackages = with pkgs; [
programs.steam.extraCompatPackages = with pkgs; [
Line 173: Line 165:
];
];
</syntaxhighlight>
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
可使用 ProtonUp-Qt 手动管理多个 Proton 版本:
Manual management of multiple Proton versions can be done with ProtonUp-Qt:
</div>
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs; [
environment.systemPackages = with pkgs; [
Line 181: Line 171:
];
];
</syntaxhighlight>
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Overriding_the_Steam_package"></span>
=== Overriding the Steam package ===
=== 覆盖 Steam 软件包 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
In some cases, you may need to override the default Steam package to provide missing dependencies or modify its build. Use the <code>programs.steam.package</code> option for this. Steam on NixOS runs many games in an FHS environment, but the Steam client itself or certain tools might need extra libraries.
In some cases, you may need to override the default Steam package to provide missing dependencies or modify its build. Use the <code>programs.steam.package</code> option for this. Steam on NixOS runs many games in an FHS environment, but the Steam client itself or certain tools might need extra libraries.
Line 221: Line 210:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
== Troubleshooting ==
=== Fix missing icons for games in GNOME dock and activities overview ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
GNOME uses the window class to determine the icon associated with a window. Steam currently doesn't set the required key for this in its .desktop files<ref>https://github.com/ValveSoftware/steam-for-linux/issues/12207</ref>, but you can fix this manually by editing the <code>StartupWMClass</code> key for each game's .desktop file, found under <code>~/.local/share/applications/</code>.
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
For all issues: first run <code>steam -dev -console</code> through the terminal and read the output.
For games running through Proton, the value should be <code>steam_app_<game_id></code> (where <code><game_id></code> matches the value after steam://rungameid/ on the <code>Exec</code> line).
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Steam fails to start. What do I do? ===
For games running natively, the value should match the game's main executable.
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Run <code>strace steam -dev -console 2> steam.logs</code> in the terminal. If <code>strace</code> is not installed, temporarily install it using <code>nix-shell -p strace</code> or <code>nix run nixpkgs#strace -- steam -dev -console 2> steam.logs</code> (if using Flakes). After that, create a bug report. <!-- This is vague. Where should the user create a bug report?  -->
For example, the modified .desktop file for Valheim looks like this:
</div>
 
<syntaxhighlight lang="desktop">
[Desktop Entry]
Name=Valheim
Comment=Play this game on Steam
Exec=steam steam://rungameid/892970
Icon=steam_icon_892970
Terminal=false
Type=Application
Categories=Game;
StartupWMClass=valheim.x86_64
</syntaxhighlight>
<span id="Troubleshooting"></span>
== 故障排除 ==
 
<div lang="en" dir="ltr" class="mw-content-ltr">
For all issues: first run <code>steam -dev -console</code> through the terminal and read the output.
</div>
</div>


<span id="Steam_fails_to_start._What_do_I_do?"></span>
=== Steam 无法启动。我该怎么办? ===
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Steam is not updated ===
Run <code>strace steam -dev -console 2> steam.logs</code> in the terminal. If <code>strace</code> is not installed, temporarily install it using <code>nix-shell -p strace</code> or <code>nix run nixpkgs#strace -- steam -dev -console 2> steam.logs</code> (if using Flakes). After that, create a bug report. <!-- This is vague. Where should the user create a bug report?  -->
</div>
</div>
<span id="Steam_is_not_updated"></span>
=== Steam 未更新 ===
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
When you restart [[Steam]] after an update, it starts the old version. ([https://github.com/NixOS/nixpkgs/issues/181904 #181904])
When you restart [[Steam]] after an update, it starts the old version. ([https://github.com/NixOS/nixpkgs/issues/181904 #181904])
Line 243: Line 259:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Game_fails_to_start"></span>
=== Game fails to start ===
=== 游戏无法启动 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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:
Line 282: Line 297:
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.
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.
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== SteamVR ===
=== SteamVR ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
The setcap issue at SteamVR start can be fixed with:
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>
<code>sudo setcap CAP_SYS_NICE+ep ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher</code>
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Gamescope_fails_to_launch_when_used_within_Steam"></span>
=== Gamescope fails to launch when used within Steam ===
=== 与 Steam 使用时 Gamescope 无法启动 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
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:
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:
Line 312: Line 324:
};
};
</syntaxhighlight>
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Udev_rules_for_additional_Gamepads"></span>
=== Udev rules for additional Gamepads ===
=== 额外游戏手柄的 udev 规则 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
In specific scenarios gamepads, might require some additional configuration in order to function properly in the form of udev rules. This can be achieved with <code>services.udev.extraRules</code>.
In specific scenarios gamepads, might require some additional configuration in order to function properly in the form of udev rules. This can be achieved with <code>services.udev.extraRules</code>.
Line 329: Line 340:
To find the vendor and product ID of a device [https://search.nixos.org/packages?channel=unstable&show=usbutils&from=0&size=50&sort=relevance&type=packages&query=usbutils usbutils] might be useful
To find the vendor and product ID of a device [https://search.nixos.org/packages?channel=unstable&show=usbutils&from=0&size=50&sort=relevance&type=packages&query=usbutils usbutils] might be useful
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Known_issues"></span>
=== Known issues ===
=== 已知问题 ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
"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>.
"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>.
Line 339: Line 349:
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.
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.
</div>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="References"></span>
== References ==
== 参考 ==
</div>


[[Category:Applications]]
[[Category:Applications]]
[[Category:Gaming]]
[[Category:Gaming]]