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

wivrn: init at 0.12 #293058

Closed
wants to merge 2 commits into from
Closed

wivrn: init at 0.12 #293058

wants to merge 2 commits into from

Conversation

PassiveLemon
Copy link
Contributor

Description of changes

Adds WiVRn
#278126 (comment)

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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.

Add a 👍 reaction to pull requests you find important.

nixos/modules/programs/wivrn.nix Outdated Show resolved Hide resolved
nixos/modules/programs/wivrn.nix Outdated Show resolved Hide resolved
@PassiveLemon
Copy link
Contributor Author

I am currently unable to get WiVRn/OpenComposite to work.
I've followed the guides here and here (while adapting them to fit my system) but games refuse to launch. If someone else is able to get results from it, let me know.

@PassiveLemon PassiveLemon force-pushed the master branch 2 times, most recently from 5788f2b to 9deebbc Compare March 3, 2024 21:36
@PassiveLemon
Copy link
Contributor Author

I did manage to get it to work so it appears that the module is functional. I will open the PR for review.

@PassiveLemon PassiveLemon marked this pull request as ready for review March 6, 2024 21:19
Copy link
Member

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! Some feedback below:

nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
@PassiveLemon PassiveLemon force-pushed the master branch 2 times, most recently from f2c0de5 to 877579f Compare March 7, 2024 22:11
@PassiveLemon
Copy link
Contributor Author

Updated with requested changes

@PassiveLemon PassiveLemon force-pushed the master branch 2 times, most recently from 404ff9d to ba0dc70 Compare March 8, 2024 03:11
@PassiveLemon
Copy link
Contributor Author

Oops, didn't get notifications for comments on those 2 open requests. Will work on those tomorrow.

@ckiee
Copy link
Member

ckiee commented Mar 13, 2024

hi, I think this should only be done after this v0.11 is merged, but here's v0.12

ckiee
ckiee previously requested changes Mar 16, 2024
Copy link
Member

@ckiee ckiee left a comment

Choose a reason for hiding this comment

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

Hi, it looks very good on the surface. Some sharp edges in the review.

pkgs/by-name/wi/wivrn/package.nix Outdated Show resolved Hide resolved
nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
nixos/modules/services/video/wivrn.nix Show resolved Hide resolved

openFirewall = mkEnableOption "the default ports in the firewall for the WiVRn server";

defaultRuntime = mkEnableOption ''
Copy link
Member

Choose a reason for hiding this comment

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

[Non-blocking] How do we know we are the only default runtime? Currently there's only vanilla monado and WiVRn so this isn't pressing yet, but we'll want to make that error nicer at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would we be able to detect if there is a conflict (Both modules being enabled as the default runtime) for Monado and WiVRn? As far as I know, the only conflict would be in the active_runtime.json as WiVRn lists its ipc separately from Monado.

Copy link
Member

Choose a reason for hiding this comment

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

Yes the behavior should already be correct if they both try to set environment.etc.… to different values, but it's not great once there are more runtimes with NixOS modules. Non-blocking.

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could have some kind of hardware.openxr interface where one can configure the default runtime and potentially other openxr-loader options

Copy link
Member

Choose a reason for hiding this comment

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

That works, but out of scope for this PR unless @PassiveLemon disagrees.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we could have some kind of hardware.openxr interface where one can configure the default runtime and potentially other openxr-loader options

I have a home-manager module that already does some of this here, but I could try to port it to a NixOS module if we think its necessary

nixos/modules/services/video/wivrn.nix Outdated Show resolved Hide resolved
Copy link
Member

@ckiee ckiee left a comment

Choose a reason for hiding this comment

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

Source looks good. I'll test it with hardware and approve later (^:

Comment on lines 55 to 62
# The library path to the OpenXR runtime requires a relative path from the config file to the binary in the nix store
# The config file is usually located at ~/.config/openxr/1/ but the wivrn module puts it at /etc/xdg/openxr/1/
# The CMakeList has relative directory paths that cause malformation of the path. https://github.com/Meumeu/WiVRn/issues/47
# What it is: ../../..//nix/store/...
# What it should be: ../../../../nix/store/...
# Details about the required path here (Section 3): https://monado.freedesktop.org/valve-index-setup.html
patchPhase = ''
substituteInPlace ./server/CMakeLists.txt \
--replace "../../../" "../../../.."
'';
Copy link
Member

Choose a reason for hiding this comment

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

Does it really require a relative path? I wonder if you could just replace ../../../ with am empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tested it without relative paths and it does appear to work but I'm not sure if that is intended functionality. I've simply just gone by what Monado/OpenComposite says to do. It would make it a lot easier if a relative path is not required though.

Copy link
Member

Choose a reason for hiding this comment

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

I am not quite sure here. The existing Nix packages for Monado generate a manifest with an absolute path.

According to the OpenXR Loader spec, both absolute and relative paths are supported. I think an absolute path is definitely preferable here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh that's real nice then haha
I think all that's left to figure out is where to generate the active_runtime.json so it can be found by Steam

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should attach a link to #293058 (comment) in the comment as well.

Copy link
Member

@ckiee ckiee Mar 19, 2024

Choose a reason for hiding this comment

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

PRESSURE_VESSEL_FILESYSTEMS_RW=/etc/xdg/openxr in the game's launch options should work. Nothing we can do about that here though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That wouldn't work because PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/wivrn_comp_ipc has to be defined to use WiVRn

Copy link
Member

Choose a reason for hiding this comment

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

Hm, maybe ask Valve to fix that missing default passthrough then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nevermind, that variables should theoretically be able to add a second path by separating it with a colon like so: PRESSURE_VESSEL_FILESYSTEMS_RW="$XDG_RUNTIME_DIR/wivrn_comp_ipc:/etc/xdg/openxr/1/active_runtime.json" %command% but I cannot get that to work. I'll try to open an issue upstream and see if I can get something done about it there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SomeoneSerge
Copy link
Contributor

As we only use vendorMonado.src below, we should be able to get rid of this completely and only keep the pinned Monado source (the value of fetchFromGitLab) in a variable

We need wivrn and monado to implement find_package support...

@ckiee
Copy link
Member

ckiee commented Mar 18, 2024

I see things are in flux again so I'll hold off on the hw testing a bit longer (^:

@PassiveLemon
Copy link
Contributor Author

Didn't know changing the name of the branch would just close the PR but I guess that makes sense. Anyways, I reopened the same PR here: #299830

@ckiee ckiee mentioned this pull request Mar 28, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants