VR/en: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
 
FuzzyBot (talk | contribs)
Updating to match new version of source page
Tags: Mobile edit Mobile web edit
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
[https://monado.freedesktop.org/ Monado] is an open source OpenXR runtime. It offers support for a variety of hardware using its built-in drivers and can be used to run any OpenXR and, with the help of OpenComposite, most OpenVR applications.
[https://monado.freedesktop.org/ Monado] is an open source OpenXR runtime. It offers support for a variety of hardware using its built-in drivers and can be used to run any OpenXR and, with the help of OpenComposite, most OpenVR applications.


Monado can be configured using its NixOS options since 24.05:
Monado can be configured using its NixOS options {{Nixos:option|services.monado.enable}}:


{{file|/etc/nixos/configuration.nix|nix|3=services.monado = {
{{file|/etc/nixos/configuration.nix|nix|3=services.monado = {
Line 16: Line 16:
   XRT_COMPOSITOR_COMPUTE = "1";
   XRT_COMPOSITOR_COMPUTE = "1";
};}}
};}}
Once configured, Monado can be started and stopped in a [[systemd]] user session.
For example, the following commands will start Monado and then follow its log output:
{{Commands|
$ systemctl --user start monado.service
$ journalctl --user --follow --unit monado.service
}}


=== Hand Tracking ===
=== Hand Tracking ===
Line 61: Line 70:
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 87: Line 96:


== WiVRn ==
== WiVRn ==
WiVRn is an OpenXR streaming application built around Monado. It wirelessly connects a standalone VR headset to a Linux computer. If your headset is not wireless, look at [[VR#Monado|Monado]] instead.
WiVRn is an OpenXR streaming application built around Monado. It wirelessly connects a standalone VR headset to a Linux computer. If your headset is not wireless, look at [[VR#Monado|Monado]] instead.
Example usage of the WiVRn module:
Example usage of the WiVRn module:
{{Warning|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.}}


{{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = {
{{File|/etc/nixos/configuration.nix|nix|3=services.wivrn = {
Line 128: Line 140:


== Envision ==
== Envision ==
Envision is an orchestrator for the FOSS VR stack. It handles the building and configuration of Monado, WiVRn, OpenComposite, and other utilities of the FOSS VR stack such as the Lighthouse driver, OpenHMD, Survive, and WMR. You can enable it with the Envision module:
Envision is an orchestrator for the FOSS VR stack. It handles the building and configuration of Monado, WiVRn, OpenComposite, and other utilities of the FOSS VR stack such as the Lighthouse driver, OpenHMD, Survive, and WMR. You can enable it with the Envision module:


Line 136: Line 149:


== SteamVR ==
== SteamVR ==
[https://store.steampowered.com/app/250820/SteamVR/ SteamVR] is a proprietary OpenVR runtime with compatibility for OpenXR. It is part of [[Steam]] and doesn't need any additional setup on NixOS apart from enabling Steam.
[https://store.steampowered.com/app/250820/SteamVR/ SteamVR] is a proprietary OpenVR runtime with compatibility for OpenXR. It is part of [[Steam]] and doesn't need any additional setup on NixOS apart from enabling Steam.


Line 142: Line 156:
On initial setup, SteamVR will ask for elevated permissions, to set up a file capability for one of its binaries. This is needed to allow asynchronous reprojection to work. Clients need the <code>CAP_SYS_NICE</code> capability to acquire a high-priority context, which is a requirement for asynchronous reprojection.
On initial setup, SteamVR will ask for elevated permissions, to set up a file capability for one of its binaries. This is needed to allow asynchronous reprojection to work. Clients need the <code>CAP_SYS_NICE</code> capability to acquire a high-priority context, which is a requirement for asynchronous reprojection.


{{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]}}
{{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, 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]}}


=== Patching AMDGPU to allow high priority queues ===
=== Patching AMDGPU to allow high priority queues ===
Line 167: Line 181:


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]]
=== Patching bubblewrap to allow capabilities ===
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.
{{Warning|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.}}
{{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
}}
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>.
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.


== wlx-overlay-s ==
== wlx-overlay-s ==
[https://github.com/galister/wlx-overlay-s wlx-overlay-s] is a lightweight OpenXR/OpenVR overlay for Wayland and X11 desktops. It works with SteamVR as well as Monado/WiVRn natively.
[https://github.com/galister/wlx-overlay-s wlx-overlay-s] is a lightweight OpenXR/OpenVR overlay for Wayland and X11 desktops. It works with SteamVR as well as Monado/WiVRn natively.


==== SteamVR autostart ====
==== SteamVR autostart ====
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:
 
{{Commands|
# Run wlx-overlay-s and replace any running instance
# Run wlx-overlay-s and replace any running instance
$ wlx-overlay-s --replace}}
$ wlx-overlay-s --replace}}
Line 179: Line 244:


* [https://lvra.gitlab.io Linux VR Adventures Wiki]
* [https://lvra.gitlab.io Linux VR Adventures Wiki]
[[Category:Video]]
[[Category:Video]]
[[Category:Hardware]]
[[Category:Hardware]]
[[Category:Desktop]]
[[Category:Desktop]]
[[Category:Gaming]]
[[Category:Gaming]]