about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2020-04-10 19:23:10 -0700
committerCole Helbling <cole.e.helbling@outlook.com>2020-04-11 16:35:28 -0700
commita276d1220d80a5b25ca70d85f1251f67fae7e179 (patch)
treeb7dcdcad45af28e9900b0e45b7d7c0e7c86fb191 /pkgs/applications/graphics
parentdc75767b7f92aa951c802907abc07eec227f90e8 (diff)
downloadnixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar.gz
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar.bz2
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar.lz
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar.xz
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.tar.zst
nixlib-a276d1220d80a5b25ca70d85f1251f67fae7e179.zip
qimgv: enable video support
I actually went back and `strace`'d the binary when it complained about
being unable to load the library it uses for playing videos. Turns out,
it wasn't finding the library because it wasn't in any of its library
paths. I added the lib path to `LD_LIBRARY_PATH` so it can find the
library it uses to play videos, and now things are peachy.

There is a (seemingly innocuous) error that gets displayed from Exiv2
being unable to determine its image type. Since it's actually a video, I
think it's fine. Another issue that pops up in the output is missing
`libcuda.so.1`, but that doesn't seem to affect functionality, and using
`addOpenGLRunpath` on both the binary and libraries didn't silence it.

Also did a little formatting.
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/qimgv/default.nix44
1 files changed, 26 insertions, 18 deletions
diff --git a/pkgs/applications/graphics/qimgv/default.nix b/pkgs/applications/graphics/qimgv/default.nix
index 6402868b9221..2756d659edf3 100644
--- a/pkgs/applications/graphics/qimgv/default.nix
+++ b/pkgs/applications/graphics/qimgv/default.nix
@@ -1,6 +1,15 @@
-{ mkDerivation, fetchFromGitHub, lib
-, pkgconfig, cmake
-, exiv2, qtbase, qtimageformats, qtsvg
+{ mkDerivation
+, lib
+, fetchFromGitHub
+
+, cmake
+, pkgconfig
+
+, exiv2
+, mpv
+, qtbase
+, qtimageformats
+, qtsvg
 }:
 
 mkDerivation rec {
@@ -14,33 +23,32 @@ mkDerivation rec {
     sha256 = "0cmya06j466v0pirhxbzbj1vbz0346y7rbc1gbv4n9xcp6c6bln6";
   };
 
-  cmakeFlags = [
-    # Video support appears to be broken; the following gets printed upon
-    # attempting to view an mp4, webm, or mkv (and probably all video formats):
-    #
-    #   [VideoPlayerInitProxy] Error - could not load player library
-    #   "qimgv_player_mpv"
-    #
-    # GIFs are unaffected. If this ever gets addressed, all that is necessary is
-    # to add `mpv` to the arguments list and to `buildInputs`, and to remove
-    # `cmakeFlags`.
-    "-DVIDEO_SUPPORT=OFF"
-  ];
-
   nativeBuildInputs = [
-    pkgconfig
     cmake
+    pkgconfig
   ];
 
   buildInputs = [
     exiv2
+    mpv
     qtbase
     qtimageformats
     qtsvg
   ];
 
+  postPatch = ''
+    sed -i "s@/usr/bin/mpv@${mpv}/bin/mpv@" \
+      qimgv/settings.cpp
+  '';
+
+  # Wrap the library path so it can see `libqimgv_player_mpv.so`, which is used
+  # to play video files within qimgv itself.
+  qtWrapperArgs = [
+    "--prefix LD_LIBRARY_PATH : ${placeholder "out"}/lib"
+  ];
+
   meta = with lib; {
-    description = "Qt5 image viewer with optional video support";
+    description = "A Qt5 image viewer with optional video support";
     homepage = "https://github.com/easymodo/qimgv";
     license = licenses.gpl3;
     platforms = platforms.linux;