Steam/zh: Difference between revisions
Created page with "Gamescope 可以作为最小桌面环境运行,这意味着您可以从 TTY 启动它,并获得与 Steam Deck 硬件控制台非常相似的体验。" |
Updating to match new version of source page |
||
| Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
[https://store.steampowered.com/ Steam] is a digital distribution platform for video games, offering a vast library for purchase, download, and management. On NixOS, Steam is generally easy to install and use, often working "out-of-the-box". It supports running many Windows games on Linux through its compatibility layer, Proton.<ref>https://store.steampowered.com/</ref> | [https://store.steampowered.com/ Steam] is a digital distribution platform for video games, offering a vast library for purchase, download, and management. On NixOS, Steam is generally easy to install and use, often working "out-of-the-box". It supports running many Windows games on Linux through its compatibility layer, [[#Proton|Proton]].<ref>https://store.steampowered.com/</ref> | ||
</div> | </div> | ||
| Line 10: | Line 10: | ||
要在 shell 环境中临时使用 Steam 相关工具,例如 <code>steam-run</code>(用于 FHS 环境)或 <code>steamcmd</code>(用于服务器管理或 steam-tui 设置等工具),可以运行以下命令。 | 要在 shell 环境中临时使用 Steam 相关工具,例如 <code>steam-run</code>(用于 FHS 环境)或 <code>steamcmd</code>(用于服务器管理或 steam-tui 设置等工具),可以运行以下命令。 | ||
<syntaxhighlight lang=" | |||
nix-shell -p steam-run # For FHS environment | <syntaxhighlight lang="console"> | ||
nix-shell -p steamcmd # For steamcmd | $ nix-shell -p steam-run # For FHS environment | ||
$ nix-shell -p steamcmd # For steamcmd | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<div class="mw-translate-fuzzy"> | |||
这样就可以在当前 shell 中使用这些工具,而无需将其添加到系统配置中。为了使 <code>steamcmd</code> 能够正确执行某些任务(例如初始化 steam-tui),您可能需要运行一次 steamcmd 来生成必要的文件,如 `steam-tui` 部分所示。 | 这样就可以在当前 shell 中使用这些工具,而无需将其添加到系统配置中。为了使 <code>steamcmd</code> 能够正确执行某些任务(例如初始化 steam-tui),您可能需要运行一次 steamcmd 来生成必要的文件,如 `steam-tui` 部分所示。 | ||
</div> | |||
<span id="System_setup"></span> | <span id="System_setup"></span> | ||
==== 系统设置 ==== | ==== 系统设置 ==== | ||
<div class="mw-translate-fuzzy"> | |||
要安装 [[Steam]] 软件包并启用所有必要的系统选项以使其运行,请将以下内容添加到您的 <code>/etc/nixos/configuration.nix</code> 中: | 要安装 [[Steam]] 软件包并启用所有必要的系统选项以使其运行,请将以下内容添加到您的 <code>/etc/nixos/configuration.nix</code> 中: | ||
< | </div> | ||
{{file|/etc/nixos/configuration.nix|nix| | |||
<nowiki> | |||
programs.steam = { | programs.steam = { | ||
enable = true; | enable = true; | ||
}; | }; | ||
| Line 31: | Line 37: | ||
# you might consider using the LTS kernel or a known stable version. | # you might consider using the LTS kernel or a known stable version. | ||
# boot.kernelPackages = pkgs.linuxPackages_lts; # Example for LTS | # boot.kernelPackages = pkgs.linuxPackages_lts; # Example for LTS | ||
</ | </nowiki> | ||
}} | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
[https://news.ycombinator.com/item?id=41549030 Anecdata on kernel 6.10 issues] | [https://news.ycombinator.com/item?id=41549030 Anecdata on kernel 6.10 issues] | ||
</div> | </div> | ||
{{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. | {{note|<span lang="en" dir="ltr" class="mw-content-ltr">Enabling [[steam]] installs several [[unfree software|unfree packages]]. If you are using <code>allowUnfreePredicate</code> you will need to ensure that your configurations permit all of them.</span> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ | nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ | ||
"steam" | "steam" | ||
"steam-unwrapped" | "steam-unwrapped" | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
| Line 50: | Line 56: | ||
== 配置 == | == 配置 == | ||
<div class="mw-translate-fuzzy"> | |||
基本 Steam 功能可以直接在 <code>programs.steam</code> 属性集中启用: | 基本 Steam 功能可以直接在 <code>programs.steam</code> 属性集中启用: | ||
< | </div> | ||
{{file|/etc/nixos/configuration.nix|nix| | |||
<nowiki> | |||
programs.steam = { | programs.steam = { | ||
enable = true; # Master switch, already covered in installation | enable = true; # Master switch, already covered in installation | ||
remotePlay.openFirewall = true; # | remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play | ||
dedicatedServer.openFirewall = true; # | dedicatedServer.openFirewall = true; # Open ports 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: | # Tip: For improved gaming performance, you can also enable GameMode: | ||
# programs.gamemode.enable = true; | # programs.gamemode.enable = true; | ||
</ | </nowiki> | ||
}} | |||
<div class="mw-translate-fuzzy"> | |||
如果您使用的是 Steam 控制器或 Valve Index,请确保已启用 Steam 硬件支持。这通常由 <code>programs.steam.enable = true;</code> 隐式地设置,该设置会同时启用 <code>hardware.steam-hardware.enable = true;</code> 。如有需要,您可以验证或显式地进行设置: | 如果您使用的是 Steam 控制器或 Valve Index,请确保已启用 Steam 硬件支持。这通常由 <code>programs.steam.enable = true;</code> 隐式地设置,该设置会同时启用 <code>hardware.steam-hardware.enable = true;</code> 。如有需要,您可以验证或显式地进行设置: | ||
< | </div> | ||
<span id="Tips_and_tricks"></span> | <span id="Tips_and_tricks"></span> | ||
== 提示和技巧 == | == 提示和技巧 == | ||
| Line 70: | Line 82: | ||
<span id="Gamescope_Compositor_/_"Boot_to_Steam_Deck""></span> | <span id="Gamescope_Compositor_/_"Boot_to_Steam_Deck""></span> | ||
=== Gamescope Compositor / "启动至 Steam Deck" === | === Gamescope Compositor / "启动至 Steam Deck" === | ||
Gamescope 可以作为最小桌面环境运行,这意味着您可以从 TTY 启动它,并获得与 Steam Deck 硬件控制台非常相似的体验。 | Gamescope 可以作为最小桌面环境运行,这意味着您可以从 TTY 启动它,并获得与 Steam Deck 硬件控制台非常相似的体验。 | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# Clean Quiet Boot | # Clean Quiet Boot | ||
boot | boot = { | ||
kernelParams = [ | |||
"quiet" | |||
"splash" | |||
"console=/dev/null" | |||
]; | |||
plymouth.enable = true; | |||
}; | |||
programs | programs = { | ||
gamescope = { | |||
enable = true; | |||
capSysNice = true; | |||
}; | |||
steam.gamescopeSession.enable = true; | |||
}; | }; | ||
# Gamescope Auto Boot from TTY (example) | # Gamescope Auto Boot from TTY (example) | ||
services | services = { | ||
xserver.enable = false; # Assuming no other Xserver needed | |||
getty.autologinUser = <"USERNAME_HERE">; | |||
greetd = { | |||
enable = true; | |||
settings = { | |||
default_session = { | |||
command = "${lib.getExe pkgs.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">; | |||
}; | |||
}; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
=== Gamescope HDR === | |||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
In order for HDR to work within gamescope, you need to separately install the <code>gamescope-wsi</code> package alongside enabling the <code>gamescope</code> program. | |||
</div> | |||
<syntaxhighlight lang="nix"> | |||
programs.gamescope = { | |||
enable = true; | enable = true; | ||
capSysNice = false; | |||
}; | }; | ||
environment.systemPackages = with pkgs; [ | |||
gamescope-wsi # HDR won't work without this | |||
]; | |||
</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Additionally, it may be necessary to force HDR in gamescope with the argument <code>--hdr-debug-force-output</code> when configuring your game's launch options in steam (see the example below). | |||
</div> | |||
<syntaxhighlight lang="bash"> | |||
gamescope -W 3840 -H 2160 -r 120 -f --adaptive-sync --hdr-enabled --hdr-debug-force-output --mangoapp -- %command% | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== steam-tui === | === steam-tui === | ||
如果您想使用 steam-tui 客户端,则需要自行安装。它依赖于 <code>steamcmd</code> 的设置,因此您需要运行一次 <code>steamcmd</code> 来生成必要的配置文件。 | 如果您想使用 steam-tui 客户端,则需要自行安装。它依赖于 <code>steamcmd</code> 的设置,因此您需要运行一次 <code>steamcmd</code> 来生成必要的配置文件。 | ||
首先,确保 <code>steamcmd</code> 可用(例如,运行 <code>nix-shell -p steamcmd</code> 或将其添加到 <code>environment.systemPackages</code> ),然后运行: | 首先,确保 <code>steamcmd</code> 可用(例如,运行 <code>nix-shell -p steamcmd</code> 或将其添加到 <code>environment.systemPackages</code> ),然后运行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
steamcmd +quit # This initializes steamcmd's directory structure | steamcmd +quit # This initializes steamcmd's directory structure | ||
</syntaxhighlight> | </syntaxhighlight> | ||
然后安装并运行 `steam-tui`。如果 `steam-tui` 出现问题,您可能需要先在 `steamcmd` 中登录: | 然后安装并运行 `steam-tui`。如果 `steam-tui` 出现问题,您可能需要先在 `steamcmd` 中登录: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# (Inside steamcmd prompt, if needed for full login before steam-tui) | # (Inside steamcmd prompt, if needed for full login before steam-tui) | ||
| Line 109: | Line 162: | ||
# quit | # quit | ||
</syntaxhighlight> | </syntaxhighlight> | ||
安装完成后, <code>steam-tui</code> (例如通过 <code>home.packages</code> 或 <code>environment.systemPackages</code> 安装)应该可以正常启动。 | 安装完成后, <code>steam-tui</code> (例如通过 <code>home.packages</code> 或 <code>environment.systemPackages</code> 安装)应该可以正常启动。 | ||
<span id="FHS_environment_only"></span> | <span id="FHS_environment_only"></span> | ||
=== 仅 FHS 环境 === | === 仅 FHS 环境 === | ||
要运行需要标准 Linux 文件系统层次结构标准 (FHS) 的专有游戏或从互联网下载的软件,可以使用 <code>steam-run</code> 。它提供了一个类似 FHS 的环境,而无需对软件进行任何修改。 | 要运行需要标准 Linux 文件系统层次结构标准 (FHS) 的专有游戏或从互联网下载的软件,可以使用 <code>steam-run</code> 。它提供了一个类似 FHS 的环境,而无需对软件进行任何修改。 | ||
请注意,对于从 Nixpkgs 安装的客户端(如 Minigalaxy 或 Itch),这并非必要,因为它们已经根据需要使用 FHS 环境。 | 请注意,对于从 Nixpkgs 安装的客户端(如 Minigalaxy 或 Itch),这并非必要,因为它们已经根据需要使用 FHS 环境。 | ||
有两种方法可以实现 <code>steam-run</code> 功能: | 有两种方法可以实现 <code>steam-run</code> 功能: | ||
1. 安装 <code>steam-run</code> ,可选择系统级安装或用户级安装: | 1. 安装 <code>steam-run</code> ,可选择系统级安装或用户级安装: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# In /etc/nixos/configuration.nix | # In /etc/nixos/configuration.nix | ||
| Line 123: | Line 179: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
2. 如果您需要更大的灵活性,或者想要使用已覆盖的 Steam 包的 FHS 环境: | 2. 如果您需要更大的灵活性,或者想要使用已覆盖的 Steam 包的 FHS 环境: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# In /etc/nixos/configuration.nix | # In /etc/nixos/configuration.nix | ||
| Line 130: | Line 188: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Proton === | === Proton === | ||
您应该可以使用 Proton 运行大多数 Windows 游戏。如果某个游戏有原生 Linux 版本,但在 NixOS 上会出现问题,您可以通过在 Steam 的游戏兼容性设置中选择特定的 Proton 版本来强制使用 Proton。 | 您应该可以使用 Proton 运行大多数 Windows 游戏。如果某个游戏有原生 Linux 版本,但在 NixOS 上会出现问题,您可以通过在 Steam 的游戏兼容性设置中选择特定的 Proton 版本来强制使用 Proton。 | ||
默认情况下,Steam 还会在 <code>~/.steam/root/compatibilitytools.d</code> 中查找自定义 Proton 版本。可以通过设置环境变量 <code>STEAM_EXTRA_COMPAT_TOOLS_PATHS</code> 来添加其他搜索路径。 | 默认情况下,Steam 还会在 <code>~/.steam/root/compatibilitytools.d</code> 中查找自定义 Proton 版本。可以通过设置环境变量 <code>STEAM_EXTRA_COMPAT_TOOLS_PATHS</code> 来添加其他搜索路径。 | ||
自定义 Proton 版本的声明式安装(例如 GE-Proton): | 自定义 Proton 版本的声明式安装(例如 GE-Proton): | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.steam.extraCompatPackages = with pkgs; [ | programs.steam.extraCompatPackages = with pkgs; [ | ||
| Line 139: | Line 202: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
可使用 ProtonUp-Qt 手动管理多个 Proton 版本: | 可使用 ProtonUp-Qt 手动管理多个 Proton 版本: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
| Line 145: | Line 210: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="Overriding_the_Steam_package"></span> | <span id="Overriding_the_Steam_package"></span> | ||
=== 覆盖 Steam 软件包 === | === 覆盖 Steam 软件包 === | ||
在某些情况下,您可能需要覆盖默认的 Steam 程序包以提供缺失的依赖项或修改其构建。为此,请使用 <code>programs.steam.package</code> 选项。NixOS 上的 Steam 会在 FHS 环境下运行许多游戏,但 Steam 客户端本身或某些工具可能需要额外的库。 | 在某些情况下,您可能需要覆盖默认的 Steam 程序包以提供缺失的依赖项或修改其构建。为此,请使用 <code>programs.steam.package</code> 选项。NixOS 上的 Steam 会在 FHS 环境下运行许多游戏,但 Steam 客户端本身或某些工具可能需要额外的库。 | ||
示例:添加 Bumblebee 和 Primus(适用于 NVIDIA Optimus): | 示例:添加 Bumblebee 和 Primus(适用于 NVIDIA Optimus): | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.steam.package = pkgs.steam.override { | programs.steam.package = pkgs.steam.override { | ||
| Line 159: | Line 228: | ||
示例:为 Gamescope 添加 Xorg 库(在 Steam 中使用时): | 示例:为 Gamescope 添加 Xorg 库(在 Steam 中使用时): | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.steam.package = pkgs.steam.override { | programs.steam.package = pkgs.steam.override { | ||
extraPkgs = pkgs': with pkgs'; [ | extraPkgs = pkgs': with pkgs'; [ | ||
libXcursor | |||
libXi | |||
libXinerama | |||
libXScrnSaver | |||
libpng | libpng | ||
libpulseaudio | libpulseaudio | ||
| Line 179: | Line 249: | ||
<span id="Fix_missing_icons_for_games_in_GNOME_dock_and_activities_overview"></span> | <span id="Fix_missing_icons_for_games_in_GNOME_dock_and_activities_overview"></span> | ||
=== 修复 GNOME Dock 栏和活动概览中游戏图标缺失的问题 === | === 修复 GNOME Dock 栏和活动概览中游戏图标缺失的问题 === | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <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>. | 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>. | ||
| Line 200: | Line 271: | ||
StartupWMClass=valheim.x86_64 | StartupWMClass=valheim.x86_64 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="Troubleshooting"></span> | <span id="Troubleshooting"></span> | ||
== 故障排除 == | == 故障排除 == | ||
| Line 207: | Line 279: | ||
<span id="Steam_fails_to_start._What_do_I_do?"></span> | <span id="Steam_fails_to_start._What_do_I_do?"></span> | ||
=== Steam 无法启动。我该怎么办? === | === Steam 无法启动。我该怎么办? === | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
One common issue preventing steam from being able to start, at least on <code>x86-64</code> platforms, is not having the following options enabled in your <code>/etc/nixos/hardware-configuration.nix</code>: | |||
</div> | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
hardware.graphics.enable = true; | |||
hardware.graphics.enable32Bit = true; | |||
} | |||
</syntaxhighlight> | |||
<div class="mw-translate-fuzzy"> | |||
在终端运行 <code>strace steam -dev -console 2> steam.logs</code> 命令。如果未安装 <code>strace</code> ,请使用 <code>nix-shell -p strace</code> 或 <code>nix run nixpkgs#strace -- steam -dev -console 2> steam.logs</code> (如果使用 Flakes 版本)临时安装。之后,请提交错误报告。 | 在终端运行 <code>strace steam -dev -console 2> steam.logs</code> 命令。如果未安装 <code>strace</code> ,请使用 <code>nix-shell -p strace</code> 或 <code>nix run nixpkgs#strace -- steam -dev -console 2> steam.logs</code> (如果使用 Flakes 版本)临时安装。之后,请提交错误报告。 | ||
</div> | |||
<span id="Steam_is_not_updated"></span> | <span id="Steam_is_not_updated"></span> | ||
=== Steam 未更新 === | === 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 218: | Line 305: | ||
<span id="Game_fails_to_start"></span> | <span id="Game_fails_to_start"></span> | ||
=== 游戏无法启动 === | === 游戏无法启动 === | ||
游戏可能无法启动,原因可能是缺少依赖项(目前应将此添加到脚本中),或者无法进行补丁更新。直接启动游戏的步骤如下: | 游戏可能无法启动,原因可能是缺少依赖项(目前应将此添加到脚本中),或者无法进行补丁更新。直接启动游戏的步骤如下: | ||
如果可以,请修补脚本/二进制文件。 | 如果可以,请修补脚本/二进制文件。 | ||
* 在二进制文件夹中添加一个名为 steam_appid.txt 的文件,内容为 appid(可在 Steam 的标准输出中找到)。 | * 在二进制文件夹中添加一个名为 steam_appid.txt 的文件,内容为 appid(可在 Steam 的标准输出中找到)。 | ||
* 使用来自 nix/store steam 脚本的 LD_LIBRARY_PATH,启动游戏二进制文件 | * 使用来自 nix/store steam 脚本的 LD_LIBRARY_PATH,启动游戏二进制文件 | ||
<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 parameter) | 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> | </syntaxhighlight> | ||
注意:如果游戏卡在“正在安装脚本”界面,请检查是否存在 DXSETUP.EXE 进程并手动运行它,然后重新启动游戏。 | 注意:如果游戏卡在“正在安装脚本”界面,请检查是否存在 DXSETUP.EXE 进程并手动运行它,然后重新启动游戏。 | ||
<span id="Changing_the_driver_on_AMD_GPUs"></span> | <span id="Changing_the_driver_on_AMD_GPUs"></span> | ||
==== 更改 AMD GPU 的驱动程序 ==== | ==== 更改 AMD GPU 的驱动程序 ==== | ||
{{note|This is not recommended because radv drivers tend to perform better and are generally more stable than amdvlk.}} | |||
{{note|<span lang="en" dir="ltr" class="mw-content-ltr">This is not recommended because radv drivers tend to perform better and are generally more stable than amdvlk.</span>}} | |||
有时,更换 AMD GPU 的驱动程序会有帮助。要尝试此方法,首先,安装多个驱动程序,例如 radv 和 amdvlk: | 有时,更换 AMD GPU 的驱动程序会有帮助。要尝试此方法,首先,安装多个驱动程序,例如 radv 和 amdvlk: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
hardware.graphics = { | hardware.graphics = { | ||
| Line 241: | Line 334: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
如果两个驱动程序都存在,[[Steam]] 将默认使用 amdvlk。amdvlk 驱动程序在 Vulkan 规范实现方面更准确,但性能不如 radv。然而,这种在正确性和性能之间的权衡有时会直接影响游戏体验。 | 如果两个驱动程序都存在,[[Steam]] 将默认使用 amdvlk。amdvlk 驱动程序在 Vulkan 规范实现方面更准确,但性能不如 radv。然而,这种在正确性和性能之间的权衡有时会直接影响游戏体验。 | ||
如果同时安装了 radv 和 amdvlk,要将驱动程序“重置”为 radv,请设置环境变量 <code>AMD_VULKAN_ICD = "RADV"</code> 或 <code>VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"</code> 。例如,如果您从 shell 启动 Steam,则可以通过运行 <code>AMD_VULKAN_ICD="RADV" steam</code> 为当前会话启用 radv。如果您不确定当前使用的是哪个驱动程序,可以启动一个启用了 MangoHud 的游戏,MangoHud 可以显示当前正在使用的驱动程序。 | 如果同时安装了 radv 和 amdvlk,要将驱动程序“重置”为 radv,请设置环境变量 <code>AMD_VULKAN_ICD = "RADV"</code> 或 <code>VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json"</code> 。例如,如果您从 shell 启动 Steam,则可以通过运行 <code>AMD_VULKAN_ICD="RADV" steam</code> 为当前会话启用 radv。如果您不确定当前使用的是哪个驱动程序,可以启动一个启用了 MangoHud 的游戏,MangoHud 可以显示当前正在使用的驱动程序。 | ||
=== SteamVR === | === SteamVR === | ||
SteamVR 启动时的 setcap 问题可以通过以下方法解决: | SteamVR 启动时的 setcap 问题可以通过以下方法解决: | ||
<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> | ||
<span id="Gamescope_fails_to_launch_when_used_within_Steam"></span> | <span id="Gamescope_fails_to_launch_when_used_within_Steam"></span> | ||
=== 与 Steam 使用时 Gamescope 无法启动 === | === 与 Steam 使用时 Gamescope 无法启动 === | ||
<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: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.steam.package = pkgs.steam.override { | programs.steam.package = pkgs.steam.override { | ||
extraPkgs = pkgs': with pkgs'; [ | extraPkgs = pkgs': with pkgs'; [ | ||
libXcursor | |||
libXi | |||
libXinerama | |||
libXScrnSaver | |||
libpng | libpng | ||
libpulseaudio | libpulseaudio | ||
| Line 268: | Line 368: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="Udev_rules_for_additional_Gamepads"></span> | <span id="Udev_rules_for_additional_Gamepads"></span> | ||
=== 额外游戏手柄的 udev 规则 === | === 额外游戏手柄的 udev 规则 === | ||
<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>. | ||
</div> | </div> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
The following example is for the 8bitdo Ultimate Bluetooth controller, different controllers will require knowledge of the vendor and product ID for the device: | The following example is for the 8bitdo Ultimate Bluetooth controller, different controllers will require knowledge of the vendor and product ID for the device: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.udev.extraRules = '' | services.udev.extraRules = '' | ||
| Line 281: | Line 385: | ||
''; | ''; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
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> | ||
<span id="Known_issues"></span> | <span id="Known_issues"></span> | ||
=== 已知问题 === | === 已知问题 === | ||
<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 293: | Line 400: | ||
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> | ||
<span id="References"></span> | <span id="References"></span> | ||
== 参考 == | == 参考 == | ||