-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
wivrn: init at 0.19 #316975
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.19 #316975
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as spam.
This comment was marked as spam.
From what Ofborg says, it looks like the monado CMake feature is involved but I don't really know why it fails. It builds on my system and it built in the other PR before |
I think it just can't build the monado derivation currently because of the downtime of FDO GitLab |
I have refactored the derivation a little, utilizing From 49cf6b5a420e347c1edcfc18f7e9787091fc1434 Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu <[email protected]>
Date: Tue, 4 Jun 2024 23:23:01 +0200
Subject: [PATCH] wivrn: refactor derivation
Signed-off-by: Sefa Eyeoglu <[email protected]>
---
pkgs/by-name/wi/wivrn/package.nix | 59 ++++++++++++++-----------------
1 file changed, 26 insertions(+), 33 deletions(-)
diff --git a/pkgs/by-name/wi/wivrn/package.nix b/pkgs/by-name/wi/wivrn/package.nix
index 67ec086ab758..81c798ee8b6b 100644
--- a/pkgs/by-name/wi/wivrn/package.nix
+++ b/pkgs/by-name/wi/wivrn/package.nix
@@ -3,7 +3,7 @@
, stdenv
, fetchFromGitHub
, fetchFromGitLab
-, fetchpatch
+, applyPatches
, avahi
, boost
, cmake
@@ -38,55 +38,36 @@
, vulkan-tools
, x264
}:
-let
- wivrnVersion = "0.15";
+stdenv.mkDerivation (finalAttrs: {
+ pname = "wivrn";
+ version = "0.15";
- wivrnSrc = fetchFromGitHub {
+ src = fetchFromGitHub {
owner = "meumeu";
repo = "wivrn";
- rev = "v${wivrnVersion}";
+ rev = "v${finalAttrs.version}";
hash = "sha256-RVRbL9hqy9pMKjvzwaP+9HGEfdpAhmlnnvqZsEGxlCw=";
};
- monadoVersion = builtins.head (builtins.elemAt (builtins.split
- "monado\n +GIT_TAG +([A-Za-z0-9]+)"
- (builtins.readFile (wivrnSrc + "/CMakeLists.txt"))
- ) 1);
-
- monado = stdenv.mkDerivation {
- pname = "monado";
- version = monadoVersion;
-
+ monadoSrc = applyPatches {
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "monado";
repo = "monado";
- rev = monadoVersion;
+ rev = "ffb71af26f8349952f5f820c268ee4774613e200";
hash = "sha256-+RTHS9ShicuzhiAVAXf38V6k4SVr+Bc2xUjpRWZoB0c=";
};
patches = [
- (wivrnSrc + "/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch")
- (wivrnSrc + "/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch")
- (wivrnSrc + "/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch")
+ ("${finalAttrs.src}/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch")
+ ("${finalAttrs.src}/patches/monado/0002-ipc-server-Always-listen-to-stdin.patch")
+ ("${finalAttrs.src}/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch")
];
postPatch = ''
substituteInPlace CMakeLists.txt --replace "add_subdirectory(doc)" ""
'';
-
- dontBuild = true;
-
- installPhase = ''
- cp -r . $out
- '';
};
-in
-stdenv.mkDerivation {
- pname = "wivrn";
- version = wivrnVersion;
-
- src = wivrnSrc;
nativeBuildInputs = [
cmake
@@ -128,6 +109,18 @@ stdenv.mkDerivation {
cudaPackages.cudatoolkit
];
+ postUnpack = ''
+ # Let's make sure our monado source revision matches what is used by WiVRn upstream
+ ourMonadoRev="${finalAttrs.monadoSrc.src.rev}"
+ theirMonadoRev=$(grep -A1 "https://gitlab.freedesktop.org/monado/monado" ${finalAttrs.src.name}/CMakeLists.txt | tail -n1 | sed 's/.*GIT_TAG\s*//')
+ if [ ! "$theirMonadoRev" == "$ourMonadoRev" ]; then
+ echo "Our Monado source revision doesn't match CMakeLists.txt." >&2
+ echo " theirs: $theirMonadoRev" >&2
+ echo " ours: $ourMonadoRev" >&2
+ return 1
+ fi
+ '';
+
cmakeFlags = [
(lib.cmakeBool "WIVRN_USE_VAAPI" true)
(lib.cmakeBool "WIVRN_USE_X264" true)
@@ -138,7 +131,7 @@ stdenv.mkDerivation {
(lib.cmakeBool "WIVRN_BUILD_CLIENT" false)
(lib.cmakeBool "WIVRN_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH" true)
(lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true)
- (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MONADO" "${monado}")
+ (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MONADO" "${finalAttrs.monadoSrc}")
];
passthru.updateScript = nix-update-script { };
@@ -146,10 +139,10 @@ stdenv.mkDerivation {
meta = with lib; {
description = "An OpenXR streaming application to a standalone headset";
homepage = "https://github.com/Meumeu/WiVRn/";
- changelog = "https://github.com/Meumeu/WiVRn/releases/tag/v${wivrnVersion}";
+ changelog = "https://github.com/Meumeu/WiVRn/releases/tag/v${finalAttrs.version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ passivelemon ];
platforms = platforms.linux;
mainProgram = "wivrn-server";
};
-}
+})
--
2.44.1 |
Actually, might it make sense to patch |
I do not recommend it, updating monado often requires changes in WiVRn itself, see latest updates on dev branch: You may backport those changes if you wish, but you may not always have a compatible version. |
I believe it currently is best to target the official releases rather than backporting changes. I like the idea case of checking if the versions match so if WiVRn is automatically updated but the Monado source isn't, a broken package isn't released. |
Also I think it would be of interest to add WiVRn configuration to the module as well. It's in json so there's probably some parts of other modules I can use to get that working. I'll probably look into it tomorrow. |
Fair enough. Is it possible to have an update script update something other than the derivation's |
Config file doesn't appear to be that hard to implement, however it's loaded from the users config dir by default and I don't think there's a flag to specify a config file to load. Not sure how this could be done otherwise. Maybe a suggestion for upstream. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/2049 |
Sorry for the wait! Changes look good. It looks like a few of the reviewers have a lot of experience with modules, so I'm making the assumption that they caught most potential problems with this module. |
@PassiveLemon Thanks for your hard work getting this working. I've fully moved off of ALVR now in favor of WiVRn, and I'm loving it. |
Can't wait to give this a try! Is anyone aware if WiVRn can be used with SteamVR and the Quest 2? |
@NovaViper I just wrote docs on it! https://wiki.nixos.org/wiki/VR#WiVRn Here's how i implemented it: Hope that helps! |
But you actually ditch SteamVR entirely with WiVRn. You launch the game from the desktop then put on the headset :p |
Thank you! Will take a look at this in the morning! |
Happy to help. Feel free to ping me on the matrix or here if you have any questions! |
🤔 I wonder if that would work with Beat Saber and VRChat (in particular Beat Saber because it's a bit hectic to get running because of its recently added OpenXR dependency). Hopefully I can get the NVEC stuff working (is actually what's currently holding up the current nixpkgs PR for the latest version for ALVR). |
I can confirm it works with Beat Saber! It was the first game I tested. Compared to ALVR. I get way better visual fidelity on my Quest 2. ALVR always seemed a bit blurry and weird no matter how much i tweaked it. Only downside over WiVRn is that you don't get all of the Steam niceties like launching your games from VR, because that's all SteamVR stuff. I guess you could use wlx-overlay-s and use Steam from there though haha. |
I think you might be able to use StardustXR for that |
@Titaniumtown Hey sorry for the lengthy delay in my reply! I finally got around to installing it but I can't figure out how to get the games to launch.. Beat Saber oddly crashes WiVRn with Segmentation Fault errors and VRChat just screams at me that it couldn't initialize EasyAntiCheat 😭 |
If you have an Nvidia GPU, make sure you have the monado-vulkan-layers (it's in unstable) installed in |
Hey thanks @PassiveLemon! Adding monado-vulkan-layers to the I'm also looking at setting up StardustXR, is there currently anyway to set it up in NixOS along with WiVRn? |
Theoretically, all you need to do is install stardust-xr-server, run it, and install and run stardust-xr-protostar (once it lands in unstable). I hadn't had much luck with getting stardust to work back when I had a headset to test with. I don't currently have access to a working headset, which makes testing significantly harder, so bug reports are very welcome. |
@Pandapip1 I gave it a try and uh.... it immediately crashes with my system 😅 . It tries to connect to WiVRn but then immediately disconnects and spams this in the terminal (completely floods it actually!):
And the only way to kill the process is by running |
btw for stardust you should run the flake at https://github.com/StardustXR/telescope because that has a full stardust setup for you ready to go :) |
@technobaboo Hey does the telescope flake work with the systemd service that the wivrn module creates? |
uhhhhhhhhhhhh i have no idea, you can easily launch the executable though? for reference i'm an XR UX designer/dev who made stardust but packaging it and such has been a total nightmare, i'm not really the best person to answer these type of questions (especially about nix) but i do know how stardust is put together. I'm genuinely considering switching off of stereokit for stardust to avoid the headache that comes along with a c++ dependency in a rust project which might just clear up all the graphics issues as bevy uses vulkan under the hood via wgpu. |
Uh... it dies still even with telescope 👀
Log for wivrn from journalctl (I put it in a file because it's really long) wivrn-with-telescope.log |
what in the world is going on here, it looks like literally nothing can connect via unix domain sockets somehow? is this in a sandbox? |
The systemd service is hardened, that might be related # Hardening options
CapabilityBoundingSet = [ "CAP_SYS_NICE" ];
AmbientCapabilities = [ "CAP_SYS_NICE" ];
LockPersonality = true;
NoNewPrivileges = true;
PrivateTmp = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProtectSystem = "strict";
RemoveIPC = true;
RestrictNamespaces = true;
RestrictSUIDSGID = true; |
yeah idk, the files are all in |
Is there a way to fix it on my end? I wonder if there needs to be a module made available on NixOS to make it function properly with the wivrn NixOS module 🤔 |
i honestly have no clue what's happening here, the way stardust works is that the server creates a unix domain socket at |
Description of changes
Adds WiVRn #278126 (comment)
Continuation of #299830 because I goofed.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.