summary refs log tree commit diff
path: root/pkgs/applications/misc/zathura
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-08-26 03:42:08 +0300
committerNikolay Amiantov <ab@fmap.me>2016-08-26 03:45:58 +0300
commit211adbeb389c5930fe132bb3c631160b92e76d0f (patch)
treed5bd6e08a84dee99a877c667c8e836e4ccb9a982 /pkgs/applications/misc/zathura
parent8d10928ad0913936ca844293cacc3c9af67d419a (diff)
downloadnixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar.gz
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar.bz2
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar.lz
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar.xz
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.tar.zst
nixlib-211adbeb389c5930fe132bb3c631160b92e76d0f.zip
zathura: cleanup and hide zathuraCollection
Fixes #17787.
Diffstat (limited to 'pkgs/applications/misc/zathura')
-rw-r--r--pkgs/applications/misc/zathura/builder.sh21
-rw-r--r--pkgs/applications/misc/zathura/core/default.nix27
-rw-r--r--pkgs/applications/misc/zathura/core/icon.xpm (renamed from pkgs/applications/misc/zathura/icon.xpm)0
-rw-r--r--pkgs/applications/misc/zathura/default.nix65
-rw-r--r--pkgs/applications/misc/zathura/djvu/default.nix14
-rw-r--r--pkgs/applications/misc/zathura/pdf-mupdf/default.nix5
-rw-r--r--pkgs/applications/misc/zathura/pdf-poppler/default.nix2
-rw-r--r--pkgs/applications/misc/zathura/ps/default.nix2
-rw-r--r--pkgs/applications/misc/zathura/wrapper.nix31
9 files changed, 74 insertions, 93 deletions
diff --git a/pkgs/applications/misc/zathura/builder.sh b/pkgs/applications/misc/zathura/builder.sh
deleted file mode 100644
index 149481367b42..000000000000
--- a/pkgs/applications/misc/zathura/builder.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-source $stdenv/setup
-
-mkdir -pv $out/bin/
-mkdir -pv $out/share/
-mkdir -pv $out/share/applications/
-mkdir -pv $out/share/pixmaps/
-
-cat > $out/bin/zathura <<EOF
-#!/bin/sh
-exec $zathura_core/bin/zathura --plugins-dir=$plugins_path "\$@"
-EOF
-
-cp -rv $zathura_core/share/man $out/share
-cp -rv $zathura_core/share/locale $out/share
-cp -rv $icon $out/share/pixmaps/pwmt.xpm
-
-cat $zathura_core/share/applications/zathura.desktop > $out/share/applications/zathura.desktop
-echo "Icon=pwmt" >> $out/share/applications/zathura.desktop
-
-chmod 755 $out/bin/zathura
-
diff --git a/pkgs/applications/misc/zathura/core/default.nix b/pkgs/applications/misc/zathura/core/default.nix
index dbb406a23e6c..4995c425699c 100644
--- a/pkgs/applications/misc/zathura/core/default.nix
+++ b/pkgs/applications/misc/zathura/core/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, lib, fetchurl, pkgconfig, gtk, girara, ncurses, gettext, docutils, file, makeWrapper, zathura_icon, sqlite, glib
-, synctexSupport ? true, texlive ? null
-}:
+{ stdenv, lib, fetchurl, pkgconfig, gtk, girara, ncurses, gettext, docutils
+, file, makeWrapper, sqlite, glib
+, synctexSupport ? true, texlive ? null }:
 
 assert synctexSupport -> texlive != null;
 
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
     sha256 = "0fyb5hak0knqvg90rmdavwcmilhnrwgg1s5ykx9wd3skbpi8nsh8";
   };
 
+  icon = ./icon.xpm;
+
   buildInputs = [ pkgconfig file gtk girara gettext makeWrapper sqlite glib
   ] ++ lib.optional synctexSupport texlive.bin.core;
 
@@ -27,23 +29,20 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     wrapProgram "$out/bin/zathura" \
-      --prefix PATH ":" "${file}/bin" \
+      --prefix PATH ":" "${lib.makeBinPath [ file ]}" \
       --prefix XDG_CONFIG_DIRS ":" "$out/etc"
 
+    install -Dm644 $icon $out/share/pixmaps/pwmt.xpm
     mkdir -pv $out/etc
-    echo "set window-icon ${zathura_icon}" > $out/etc/zathurarc
+    echo "set window-icon $out/share/pixmaps/pwmt.xpm" > $out/etc/zathurarc
+    echo "Icon=pwmt" >> $out/share/applications/zathura.desktop
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://pwmt.org/projects/zathura/;
     description = "A core component for zathura PDF viewer";
-    license = stdenv.lib.licenses.zlib;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.garbas ];
-
-    # Set lower priority in order to provide user with a wrapper script called
-    # 'zathura' instead of real zathura executable. The wrapper will build
-    # plugin path argument before executing the original.
-    priority = 1;
+    license = licenses.zlib;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ garbas ];
   };
 }
diff --git a/pkgs/applications/misc/zathura/icon.xpm b/pkgs/applications/misc/zathura/core/icon.xpm
index a863c5ddb090..a863c5ddb090 100644
--- a/pkgs/applications/misc/zathura/icon.xpm
+++ b/pkgs/applications/misc/zathura/core/icon.xpm
diff --git a/pkgs/applications/misc/zathura/default.nix b/pkgs/applications/misc/zathura/default.nix
index ed121be6dcdb..e67bebb37100 100644
--- a/pkgs/applications/misc/zathura/default.nix
+++ b/pkgs/applications/misc/zathura/default.nix
@@ -1,59 +1,30 @@
-{ callPackage, lib, pkgs, fetchurl, stdenv, useMupdf, synctexSupport ? true }:
+{ pkgs, useMupdf ? true, synctexSupport ? true }:
 
-rec {
-  inherit stdenv;
+let
+  callPackage = pkgs.newScope self;
 
-  icon = ./icon.xpm;
-
-  zathura_core = callPackage ./core {
-    gtk = pkgs.gtk3;
-    zathura_icon = icon;
-    inherit synctexSupport;
-  };
-
-  zathura_pdf_poppler = callPackage ./pdf-poppler { };
-
-  zathura_pdf_mupdf = callPackage ./pdf-mupdf {
-    gtk = pkgs.gtk3;
-  };
-
-  zathura_djvu = callPackage ./djvu {
+  self = rec {
     gtk = pkgs.gtk3;
-  };
 
-  zathura_ps = callPackage ./ps {
-    gtk = pkgs.gtk3;
-  };
-
-  zathuraWrapper = stdenv.mkDerivation {
-
-    inherit zathura_core icon;
+    zathura_core = callPackage ./core {
+      inherit synctexSupport;
+    };
 
-    name = "zathura-${zathura_core.version}";
+    zathura_pdf_poppler = callPackage ./pdf-poppler { };
 
-    plugins_path = stdenv.lib.makeLibraryPath [
-      zathura_djvu
-      zathura_ps
-      (if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
-    ];
+    zathura_pdf_mupdf = callPackage ./pdf-mupdf { };
 
-    builder = ./builder.sh;
+    zathura_djvu = callPackage ./djvu { };
 
-    preferLocalBuild = true;
+    zathura_ps = callPackage ./ps { };
 
-    meta = with lib; {
-      homepage = http://pwmt.org/projects/zathura/;
-      description = "A highly customizable and functional PDF viewer";
-      longDescription = ''
-        Zathura is a highly customizable and functional PDF viewer based on the
-        poppler rendering library and the gtk+ toolkit. The idea behind zathura
-        is an application that provides a minimalistic and space saving interface
-        as well as an easy usage that mainly focuses on keyboard interaction.
-      '';
-      license = licenses.zlib;
-      platforms = platforms.linux;
-      maintainers = with maintainers;[ garbas smironov ];
+    zathuraWrapper = callPackage ./wrapper.nix {
+      plugins = [
+        zathura_djvu
+        zathura_ps
+        (if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
+      ];
     };
   };
-}
 
+in self.zathuraWrapper
diff --git a/pkgs/applications/misc/zathura/djvu/default.nix b/pkgs/applications/misc/zathura/djvu/default.nix
index 21e482b1fd28..2e644453dcb9 100644
--- a/pkgs/applications/misc/zathura/djvu/default.nix
+++ b/pkgs/applications/misc/zathura/djvu/default.nix
@@ -12,18 +12,18 @@ stdenv.mkDerivation rec {
 
   patches = [ ./gtkflags.patch ];
 
-  makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
+  makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://pwmt.org/projects/zathura/;
     description = "A zathura DJVU plugin";
     longDescription = ''
-	  The zathura-djvu plugin adds DjVu support to zathura by using the
-	  djvulibre library.
+      The zathura-djvu plugin adds DjVu support to zathura by using the
+      djvulibre library.
     '';
-    license = stdenv.lib.licenses.zlib;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.garbas ];
+    license = licenses.zlib;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ garbas ];
   };
 }
 
diff --git a/pkgs/applications/misc/zathura/pdf-mupdf/default.nix b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
index b8f75b7151f5..a78c94173e42 100644
--- a/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
+++ b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl, libjpeg, jbig2dec, openjpeg, fetchpatch}:
+{ stdenv, lib, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl
+, libjpeg, jbig2dec, openjpeg, fetchpatch }:
 
 stdenv.mkDerivation rec {
   version = "0.3.0";
@@ -15,7 +16,7 @@ stdenv.mkDerivation rec {
 
   patches = [(fetchpatch {
     name = "mupdf-1.9.patch";
-    url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/mupdf-1.9.patch?h=packages/zathura-pdf-mupdf";
+    url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/mupdf-1.9.patch?h=packages/zathura-pdf-mupdf&id=385ad96261b7297fdebbee6f4b22ec20dda8d65e";
     sha256 = "185wgg0z4b0z5aybcnnyvbs50h43imn5xz3nqmya4rk4v5bwy49y";
   })];
 
diff --git a/pkgs/applications/misc/zathura/pdf-poppler/default.nix b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
index 6c390d1ed855..4912489d6b35 100644
--- a/pkgs/applications/misc/zathura/pdf-poppler/default.nix
+++ b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ pkgconfig poppler zathura_core girara ];
 
-  makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
+  makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
 
   meta = with lib; {
     homepage = http://pwmt.org/projects/zathura/;
diff --git a/pkgs/applications/misc/zathura/ps/default.nix b/pkgs/applications/misc/zathura/ps/default.nix
index 630f45a1e41f..89d8d5badb0a 100644
--- a/pkgs/applications/misc/zathura/ps/default.nix
+++ b/pkgs/applications/misc/zathura/ps/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./gtkflags.patch ];
 
-  makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
+  makeFlags = [ "PREFIX=$(out)" "PLUGINDIR=$(out)/lib" ];
 
   meta = with lib; {
     homepage = http://pwmt.org/projects/zathura/;
diff --git a/pkgs/applications/misc/zathura/wrapper.nix b/pkgs/applications/misc/zathura/wrapper.nix
new file mode 100644
index 000000000000..55ac9bd187a7
--- /dev/null
+++ b/pkgs/applications/misc/zathura/wrapper.nix
@@ -0,0 +1,31 @@
+{ symlinkJoin, lib, makeWrapper, zathura_core, plugins ? [] }:
+
+let
+  pluginsPath = lib.makeLibraryPath plugins;
+
+in symlinkJoin {
+  name = "zathura-with-plugins-${zathura_core.version}";
+
+  paths = [ zathura_core ];
+
+  buildInputs = [ makeWrapper ];
+
+  postBuild = ''
+    wrapProgram $out/bin/zathura \
+      --add-flags --plugins-dir=${pluginsPath}
+  '';
+
+  meta = with lib; {
+    homepage = http://pwmt.org/projects/zathura/;
+    description = "A highly customizable and functional PDF viewer";
+    longDescription = ''
+      Zathura is a highly customizable and functional PDF viewer based on the
+      poppler rendering library and the gtk+ toolkit. The idea behind zathura
+      is an application that provides a minimalistic and space saving interface
+      as well as an easy usage that mainly focuses on keyboard interaction.
+    '';
+    license = licenses.zlib;
+    platforms = platforms.linux;
+    maintainers = with maintainers;[ garbas smironov ];
+  };
+}