@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, fetchpatch, pkgconfig, perl, texinfo, yasm
1+{ stdenv, addOpenGLRunpath, fetchurl, fetchpatch, pkgconfig, perl, texinfo, yasm
22/*
33 * Licensing options (yes some are listed twice, filters and such are not listed)
44 */
@@ -416,7 +416,7 @@ stdenv.mkDerivation rec {
416416 "--enable-cross-compile"
417417 ];
418418
419− nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
419+ nativeBuildInputs = [ addOpenGLRunpath perl pkgconfig texinfo yasm ];
420420
421421 buildInputs = [
422422 bzip2 celt dav1d fontconfig freetype frei0r fribidi game-music-emu gnutls gsm
@@ -444,6 +444,13 @@ stdenv.mkDerivation rec {
444444 cp -a tools/qt-faststart $out/bin/
445445 '';
446446
447+ postFixup = optionalString stdenv.isLinux ''
448+ # Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found.
449+ # See the explanation in addOpenGLRunpath.
450+ addOpenGLRunpath $out/lib/libavcodec.so
451+ addOpenGLRunpath $out/lib/libavutil.so
452+ '';
453+
447454 enableParallelBuilding = true;
448455
449456 meta = with stdenv.lib; {