Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/monado: init #245005

Merged
merged 7 commits into from
Feb 27, 2024
Merged

nixos/monado: init #245005

merged 7 commits into from
Feb 27, 2024

Conversation

Scrumplex
Copy link
Member

@Scrumplex Scrumplex commented Jul 23, 2023

Description of changes

Closes #275107

This module ensures that we have a monado.service that has CAP_SYS_NICE to utilize asynchronous reprojection. (See #217119) for details about asynchronous reprojection)

This effectively shadows the unit files packaged in monado. Maybe it is desirable to remove those from the packages.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation 8.has: changelog 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 23, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jul 23, 2023
Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested but diff looks pretty good to me.

A couple things:

nixos/modules/services/hardware/monado.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/monado.nix Outdated Show resolved Hide resolved
@Scrumplex Scrumplex force-pushed the nixos-monado branch 2 times, most recently from 29dba97 to 67d5332 Compare September 7, 2023 07:03
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Oct 19, 2023
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/3097

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes labels Dec 18, 2023
@loco-choco
Copy link
Member

It would be nice if the service would also set a symlink for ~/.config/openxr/1/active_runtime.json from share/openxr/1/openxr_monado.json. Correct me if I am wrong, but I feel like the setupHook should help with this, but for some reason, if I have the monado pkg in environment.systemPackages, openxr_runtime_list can't find the runtime file.

@Scrumplex
Copy link
Member Author

It would be nice if the service would also set a symlink for ~/.config/openxr/1/active_runtime.json from share/openxr/1/openxr_monado.json. Correct me if I am wrong, but I feel like the setupHook should help with this, but for some reason, if I have the monado pkg in environment.systemPackages, openxr_runtime_list can't find the runtime file.

The setupHook of monado does not affect packages you install using environment.systemPackages. But I could add an option to this module to make Monado the default runtime on the system. Note that that option might not work if for example SteamVR defines a default runtime in ~/.config/openxr

@Scrumplex
Copy link
Member Author

Scrumplex commented Dec 18, 2023

I tried to make the test more precise by querying the active OpenXR runtime using openxr_runtime_list from openxr-loader, but for some reason I couldn't get it to detect Monado's socket properly

Edit: Got it working! :D

@Scrumplex Scrumplex force-pushed the nixos-monado branch 2 times, most recently from 476f52c to 3df6e04 Compare December 18, 2023 17:24
Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to enable the user socket manually after switch (a general NixOS issue I believe) and explicitly declare the XR runtime but was then able to run xrgears:

XR_RUNTIME_JSON=/run/current-system/sw/share/openxr/1/openxr_monado.json xrgears

A few nits, questions and remarks.

nixos/modules/services/hardware/monado.nix Show resolved Hide resolved
nixos/tests/monado.nix Show resolved Hide resolved
nixos/tests/monado.nix Show resolved Hide resolved
nixos/modules/services/hardware/monado.nix Show resolved Hide resolved
@Atemu
Copy link
Member

Atemu commented Dec 18, 2023

Hold on, just hit this:

Dec 18 20:45:28 HEPHAISTOS systemd[2711]: monado.service: Main process exited, code=exited, status=255/EXCEPTION
Dec 18 20:45:28 HEPHAISTOS systemd[2711]: monado.service: Failed with result 'exit-code'.
Dec 18 20:45:28 HEPHAISTOS systemd[2711]: monado.service: Start request repeated too quickly.
Dec 18 20:45:28 HEPHAISTOS systemd[2711]: monado.service: Failed with result 'exit-code'.
Dec 18 20:45:28 HEPHAISTOS systemd[2711]: Failed to start Monado XR runtime service module.
Dec 18 20:45:28 HEPHAISTOS systemd[2711]: monado.socket: Failed with result 'service-start-limit-hit'.

The socket should probably be configured to get back up in this case.

@Scrumplex
Copy link
Member Author

Scrumplex commented Jan 6, 2024

The security wrapper for CAP_SYS_NICE is now configurable. Someone told me that they had issues running Monado with it enabled on an NVIDIA system

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/3416

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nixpkgs-xr-nightly-packages-for-xr-ar-vr-tools-and-apps/40083/1

@Atemu
Copy link
Member

Atemu commented Feb 21, 2024

I had intended to test this but had not found the time yet. If I haven't tested in a week, please ping me again and I'll just merge because the diff does LGTM.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
@jsw08
Copy link

jsw08 commented Feb 24, 2024

Hey would it be possible for you to add an option to compile monado with basalt for wmr controller tracking? I tried to package it myself and failed.

@Scrumplex
Copy link
Member Author

I could look into it, but it wouldn't be in scope for this PR I think

@jsw08
Copy link

jsw08 commented Feb 24, 2024

I could look into it, but it wouldn't be in scope for this PR I think

Okay, thank you. I'll look into it a bit more myself.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work, thank you so much!

@Atemu Atemu merged commit 97f445e into NixOS:master Feb 27, 2024
24 checks passed
@loco-choco
Copy link
Member

I could look into it, but it wouldn't be in scope for this PR I think

Okay, thank you. I'll look into it a bit more myself.

I was able to get a build of monado's version of basalt here, it uses an older version of pangolin, and some packages that aren't packaged in nix like Sophus. I just need to test it with monado to see if it is actually working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes needs_reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing udev rules in Monado Package
8 participants