VR/ja: Difference between revisions

Haruki7049 (talk | contribs)
Created page with "Monadoを設定すると、もしかすると追加の環境変数を設定したくなるかもしれません:"
FuzzyBot (talk | contribs)
Updating to match new version of source page
Tags: Mobile edit Mobile web edit
 
(8 intermediate revisions by 2 users not shown)
Line 5: Line 5:
</div>
</div>


<div class="mw-translate-fuzzy">
MonadoはNixOS 24.05以降、NixOSのオプションを使用して設定できます:
MonadoはNixOS 24.05以降、NixOSのオプションを使用して設定できます:
</div>


{{file|/etc/nixos/configuration.nix|nix|3=services.monado = {
{{file|/etc/nixos/configuration.nix|nix|3=services.monado = {
Line 20: Line 22:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Hand Tracking ===
Once configured, Monado can be started and stopped in a [[systemd]] user session.
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
You may notice that running <code>monado-services</code> will fail due to the lack of hand tracking data.  There are 2 ways to remedy this, either disable hand tracking altogether, or download the hand tracking data.
For example, the following commands will start Monado and then follow its log output:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{Commands|
To disable hand tracking, modify the environment variable to include <code>WMR_HANDTRACKING = "0";</code>, so that it will look like this.
$ systemctl --user start monado.service
</div>
$ journalctl --user --follow --unit monado.service
}}
 
<span id="Hand_Tracking"></span>
=== ハンドトラッキング ===
 
ハンドトラッキング用のデータがないため、<code>monado-services</code>の実行が失敗することに気づくかもしれません。これを直すためには、ハンドトラッキングを完全に無効にするか、ハンドトラッキング用のデータをダウンロードするかの二つの方法があります。
 
ハンドトラッキングを無効にするには、<code>WMR_HANDTRACKING = "0";</code>を含むように環境変数を変更します。つまり以下のようになります。


{{file|/etc/nixos/configuration.nix|nix|3=systemd.user.services.monado.environment = {
{{file|/etc/nixos/configuration.nix|nix|3=systemd.user.services.monado.environment = {
Line 37: Line 47:
};}}
};}}


<div lang="en" dir="ltr" class="mw-content-ltr">
ハンドトラッキングを動作させるには、<code>git-lfs</code>を有効にする必要があります。<code>git-lfs</code>を有効にする標準的な方法は、以下の設定です
To get hand tracking to work, you require <code>git-lfs</code> to be enabled.  The standard way of enabling <code>git-lfs</code> is through the configuration below
</div>


{{file|/etc/nixos/configuration.nix|nix|3=programs.git = {
{{file|/etc/nixos/configuration.nix|nix|3=programs.git = {
Line 46: Line 54:
};}}
};}}


<div lang="en" dir="ltr" class="mw-content-ltr">
<code>git-lfs</code>が有効になっていることを確認した後、以下のコマンドを実行して<code>monado-service</code>を再起動します
After making sure <code>git-lfs</code> is enabled, run these commands and restart <code>monado-service</code>
</div>


{{Commands|
{{Commands|
Line 60: Line 66:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
== OpenComposite ==
== OpenComposite ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 72: Line 76:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{Warning|<span lang="en" dir="ltr" class="mw-content-ltr">Older versions of Proton will always query the current OpenVR and OpenXR runtime. If you use OpenComposite, and it fails to initialize an OpenXR context, Proton will fail to launch. A workaround is to delete the ~/.config/openvr/openvrpaths.vrpath file and then retry launching the game.</span>}}
{{Warning|Older versions of Proton will always query the current OpenVR and OpenXR runtime. If you use OpenComposite, and it fails to initialize an OpenXR context, Proton will fail to launch. A workaround is to delete the ~/.config/openvr/openvrpaths.vrpath file and then retry launching the game.}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 87: Line 89:
xdg.configFile."openxr/1/active_runtime.json".source = "${pkgs.monado}/share/openxr/1/openxr_monado.json";
xdg.configFile."openxr/1/active_runtime.json".source = "${pkgs.monado}/share/openxr/1/openxr_monado.json";


# For WiVRn:
# For WiVRn v0.22 and below:
xdg.configFile."openxr/1/active_runtime.json".source = "${pkgs.wivrn}/share/openxr/1/openxr_wivrn.json";
xdg.configFile."openxr/1/active_runtime.json".source = "${pkgs.wivrn}/share/openxr/1/openxr_wivrn.json";


Line 122: Line 124:
Example usage of the WiVRn module:
Example usage of the WiVRn module:
</div>
</div>
{{Warning|<span lang="en" dir="ltr" class="mw-content-ltr">As of WiVRn version 0.23, WiVRn now manages the opencomposite paths itself. Only use the above opencomposite configuration when using versions below v0.23.</span>}}


{{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = {
{{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = {
Line 191: Line 195:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{Note|<span lang="en" dir="ltr" class="mw-content-ltr">Steam is run in a bubblewrap-based FHS environment. This environment runs Steam in a user namespace, which prevents it from using any capabilities or setuid binaries. This means that asynchronous reprojection can not be used on NixOS, without patching the kernel to remove these restrictions completely, or modifying the bubblewrap binary used for running Steam to remove these capability protections. Both of these workarounds come with their own security tradeoffs. See this [https://github.com/NixOS/nixpkgs/issues/217119 Nixpkgs issue]</span>}}
{{Note|Steam is run in a bubblewrap-based FHS environment. This environment runs Steam in a user namespace, which prevents it from using any capabilities or setuid binaries. This means that asynchronous reprojection can not be used on NixOS, without patching the kernel to remove these restrictions completely. See this [https://github.com/NixOS/nixpkgs/issues/217119 Nixpkgs issue]}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 203: Line 205:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{Warning|<span lang="en" dir="ltr" class="mw-content-ltr">This removes intentional restrictions from the kernel, and it could cause scheduling issues. While it has not been reported that it does cause issues, this should be considered an unsupported configuration.</span>}}
{{Warning|This removes intentional restrictions from the kernel, and it could cause scheduling issues. While it has not been reported that it does cause issues, this should be considered an unsupported configuration.}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 229: Line 229:
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
It is also possible to just patch amdgpu and build it as an out-of-tree module, as described in [[Linux_kernel#Patching_a_single_In-tree_kernel_module]]
It is also possible to just patch amdgpu and build it as an out-of-tree module, as described in [[Linux_kernel#Patching_a_single_In-tree_kernel_module]]
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Patching bubblewrap to allow capabilities ===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
By modifying the bubblewrap binary used for running Steam, you can allow processes in that FHS environment to acquire capabilities. This removes the need for patching the kernel directly.
</div>
{{Warning|<span lang="en" dir="ltr" class="mw-content-ltr">This circumvents an intended security mechanism in bubblewrap, and allows all other software launched by steam, or running via steam-run to acquire these capabilities as well.</span>}}
{{file|/etc/nixos/configuration.nix|nix|3=programs.steam = let
  patchedBwrap = pkgs.bubblewrap.overrideAttrs (o: {
    patches = (o.patches or []) ++ [
      ./bwrap.patch
    ];
  });
in {
  enable = true;
  package = pkgs.steam.override {
    buildFHSEnv = (args: ((pkgs.buildFHSEnv.override {
      bubblewrap = patchedBwrap;
    }) (args // {
      extraBwrapArgs = (args.extraBwrapArgs or []) ++ [ "--cap-add ALL" ];
    })));
  };
};
}}
{{file|/etc/nixos/bwrap.patch|diff|3=diff --git a/bubblewrap.c b/bubblewrap.c
index 8322ea0..4e20262 100644
--- a/bubblewrap.c
+++ b/bubblewrap.c
@@ -868,13 +868,6 @@ acquire_privs (void)
      /* Keep only the required capabilities for setup */
      set_required_caps ();
    }
-  else if (real_uid != 0 && has_caps ())
-    {
-      /* We have some capabilities in the non-setuid case, which should not happen.
-        Probably caused by the binary being setcap instead of setuid which we
-        don't support anymore */
-      die ("Unexpected capabilities but not setuid, old file caps config?");
-    }
  else if (real_uid == 0)
    {
      /* If our uid is 0, default to inheriting all caps; the caller
}}
<div lang="en" dir="ltr" class="mw-content-ltr">
as an additional change, you may also need to replace Steam's own bwrap binary with a symbolic link to this modified bwrap binary, found at <code>~/.local/share/Steam/ubuntu12_32/steam-runtime/usr/libexec/steam-runtime-tools-0/srt-bwrap</code>.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Steam will periodically replace this modification with its own binary when steam-runtime updates, so you may need to re-apply this change if it breaks.
</div>
</div>


Line 244: Line 299:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
When launching wlx-overlay-s in SteamVR (or any OpenVR compositor) it will register an autostart manifest. Currently, this manifest will reference a Nix store path of wlx-overlay-s, which might get garbage collected after rebuilds of your NixOS/Nix profile. A workaround is to regularly run the following command to update the manifest's store path:{{Commands|
When launching wlx-overlay-s in SteamVR (or any OpenVR compositor) it will register an autostart manifest. Currently, this manifest will reference a Nix store path of wlx-overlay-s, which might get garbage collected after rebuilds of your NixOS/Nix profile. A workaround is to regularly run the following command to update the manifest's store path:
# Run wlx-overlay-s and replace any running instance
</div>
 
{{Commands|
# <span lang="en" dir="ltr" class="mw-content-ltr">Run wlx-overlay-s and replace any running instance</span>
$ wlx-overlay-s --replace}}
$ wlx-overlay-s --replace}}
</div>
 
<span id="See_also"></span>
== 参照リンク ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
== See also ==
* [https://lvra.gitlab.io Linux VR Adventures Wiki]
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
* [https://lvra.gitlab.io Linux VR Adventures Wiki]
[[Category:Video]]
[[Category:Video]]
[[Category:Hardware]]
[[Category:Hardware]]