nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 symlinkJoin,
3 lib,
4 makeWrapper,
5 zathura_core,
6 zathura_djvu,
7 zathura_ps,
8 zathura_cb,
9 zathura_pdf_mupdf,
10 zathura_pdf_poppler,
11 file,
12 useMupdf,
13 plugins ? [
14 zathura_djvu
15 zathura_ps
16 zathura_cb
17 (if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
18 ],
19 stdenv,
20}:
21symlinkJoin {
22 inherit (zathura_core) version;
23 pname = "zathura-with-plugins";
24
25 paths =
26 with zathura_core;
27 [
28 man
29 dev
30 out
31 ]
32 ++ plugins;
33
34 nativeBuildInputs = [ makeWrapper ];
35
36 postBuild =
37 let
38 fishCompletion = "share/fish/vendor_completions.d/zathura.fish";
39 in
40 (lib.optionalString stdenv.hostPlatform.isLinux ''
41 makeWrapper ${zathura_core.bin}/bin/zathura-sandbox $out/bin/zathura-sandbox \
42 --prefix PATH ":" "${lib.makeBinPath [ file ]}" \
43 --prefix ZATHURA_PLUGINS_PATH : "$out/lib/zathura"
44 '')
45 + ''
46 makeWrapper ${zathura_core.bin}/bin/zathura $out/bin/zathura \
47 --prefix PATH ":" "${lib.makeBinPath [ file ]}" \
48 --prefix ZATHURA_PLUGINS_PATH : "$out/lib/zathura"
49
50 # zathura fish completion references the zathura_core derivation to
51 # check for supported plugins which live in the wrapper derivation,
52 # so we need to fix the path to reference $out instead.
53 rm "$out/${fishCompletion}"
54 substitute "${zathura_core.out}/${fishCompletion}" "$out/${fishCompletion}" \
55 --replace-fail "${zathura_core.out}" "$out"
56 '';
57
58 meta = {
59 homepage = "https://pwmt.org/projects/zathura";
60 description = "Highly customizable and functional PDF viewer";
61 longDescription = ''
62 Zathura is a highly customizable and functional PDF viewer based on the
63 poppler rendering library and the GTK toolkit. The idea behind zathura
64 is an application that provides a minimalistic and space saving interface
65 as well as an easy usage that mainly focuses on keyboard interaction.
66 '';
67 license = lib.licenses.zlib;
68 platforms = lib.platforms.unix;
69 maintainers = with lib.maintainers; [
70 smironov
71 globin
72 TethysSvensson
73 ];
74 mainProgram = "zathura";
75 };
76}