-
-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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.17 #316975
base: master
Are you sure you want to change the base?
wivrn: init at 0.17 #316975
Conversation
Welcome back.. It's a right of passage sometimes. |
Both |
@GrahamcOfBorg eval |
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 <contact@scrumplex.net>
Date: Tue, 4 Jun 2024 23:23:01 +0200
Subject: [PATCH] wivrn: refactor derivation
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
---
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. |
|
||
Note that applications can bypass this option by setting an active | ||
runtime in a writable XDG_CONFIG_DIRS location like `~/.config` | ||
'' // { default = true; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this not be true by default?
https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/hardware/monado.nix#L18-L28
applicationListNotEmpty = ( | ||
if builtins.isList cfg.config.json.application | ||
then if builtins.length cfg.config.json.application == 0 | ||
then false | ||
else true | ||
else true | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applicationListNotEmpty = ( | |
if builtins.isList cfg.config.json.application | |
then if builtins.length cfg.config.json.application == 0 | |
then false | |
else true | |
else true | |
); | |
applicationListNotEmpty = builtins.isList cfg.config.json.application | |
|| builtins.length cfg.config.json.application != 0; |
5d824e3
to
514056b
Compare
Should I add an option for starting by default through "wantedBy = [ "multi-user.target" ];"? I would think it makes sense for it to be started by automatically. |
Since it's a user service, shouldn't it be |
It think it should be, though I'm not 100% sure. We could also make it depend on graphical.target instead but I also don't know if WiVRn requires that. I'll have to check and see |
WiVRn shouldn't need |
Pushed an option for enabling autostarting. Still waiting for the previous reviews to be resolved |
Only the pull request author and committers can resolve reviews (not even the review author)! You should manually resolve any resolved discussions yourself. |
I did not know that. We still didn't come to a conclusion so i'm unsure if those discussions are resolved or not |
#316975 (comment) and #316975 (comment) are unresolved nits. #316975 (comment) is also an unresolved nit. The code it's pointing to is outdated. It refers to these updated lines: nixpkgs/nixos/modules/services/video/wivrn.nix Lines 11 to 15 in 7fa26b1
|
Updated to release 0.17 |
f12ffb0
to
c2b18de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, despite the nits
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.