Subject: [bug#36814] [BONUS PATCH 3/2] gnu: intel-vaapi-driver: Provide LIBVA_DRIVERS_PATH.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Fri, 26 Jul 2019 20:40:40 +0200

* gnu/packages/video.scm (intel-vaapi-driver)[native-search-paths]:
Export LIBVA_DRIVERS_PATH when installed.
(libva-without-mesa)[native-search-paths]: Don't inherit any.
---

Guix,

This ties the two together.

I'm leaving the enormocomment in so I don't have to repeat it here, but I'm less sure about it now than when I wrote it.  I thought this was a filthy hack, but maybe it's just mildly unconventional ;-)  The documentation is very sparse indeed.

I don't see any acceptable alternative.

Stormy regards,

T G-R

 gnu/packages/gl.scm    |  3 ++-
 gnu/packages/video.scm | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 9ed043c7ae..9495e8ee24 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -219,7 +219,8 @@ also known as DXTn or DXTC) for Mesa.")
         '(#:make-flags)
         (substitute-keyword-arguments (package-arguments libva)
           ((#:configure-flags flags)
-           '(list "--disable-glx" "--disable-egl"))))))))
+           '(list "--disable-glx" "--disable-egl")))))
+      (native-search-paths '()))))
 
 (define-public mesa
   (package
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index b441c5e311..5e26b4c2dc 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2756,6 +2756,19 @@ of modern, widely supported codecs.")
              (let ((out (assoc-ref outputs "out")))
                (setenv "LIBVA_DRIVERS_PATH" (string-append out "/lib/dri"))
                #t))))))
+    ;; XXX This variable is actually respected by libva, and in a perfect world
+    ;; would be found there instead.  Unfortunately, native-search-paths are set
+    ;; up only if the package using them is installed directly into the profile.
+    ;; This means that users would need to install libva into their profile for
+    ;; no good reason other than convincing Guix to export the right paths, or
+    ;; that every single one of libva's many dependents would would need to be
+    ;; modified instead (and would still be semantically dubious).  Moving it
+    ;; here is logically (almost) equivalent, and keeps this hack confined to a
+    ;; tiny handful of back-end packages.
+    (native-search-paths
+     (list (search-path-specification
+            (variable "LIBVA_DRIVERS_PATH")
+            (files '("lib/dri")))))
     (home-page "https://01.org/linuxmedia/vaapi")
     (synopsis "VA-API video acceleration driver for Intel GEN Graphics devices")
     (description
-- 
2.22.0