2019-02-03 15:33:34 +00:00
|
|
|
{ config, pkgs
|
2019-05-11 21:42:58 +00:00
|
|
|
# zathura_pdf_mupdf fails to load _opj_create_decompress at runtime on Darwin (https://github.com/NixOS/nixpkgs/pull/61295#issue-277982980)
|
2019-08-01 19:05:25 +00:00
|
|
|
, useMupdf ? config.zathura.useMupdf or (!pkgs.stdenv.isDarwin) }:
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
let
|
|
|
|
callPackage = pkgs.newScope self;
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
self = rec {
|
2013-11-23 14:19:54 +00:00
|
|
|
gtk = pkgs.gtk3;
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2019-08-01 19:05:25 +00:00
|
|
|
zathura_core = callPackage ./core { };
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
zathura_pdf_poppler = callPackage ./pdf-poppler { };
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
zathura_pdf_mupdf = callPackage ./pdf-mupdf { };
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
zathura_djvu = callPackage ./djvu { };
|
2012-05-14 21:43:46 +00:00
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
zathura_ps = callPackage ./ps { };
|
2014-02-10 20:03:17 +00:00
|
|
|
|
2019-03-10 20:04:56 +00:00
|
|
|
zathura_cb = callPackage ./cb { };
|
|
|
|
|
2016-08-26 00:42:08 +00:00
|
|
|
zathuraWrapper = callPackage ./wrapper.nix {
|
|
|
|
plugins = [
|
|
|
|
zathura_djvu
|
|
|
|
zathura_ps
|
2019-03-10 20:04:56 +00:00
|
|
|
zathura_cb
|
2016-08-26 00:42:08 +00:00
|
|
|
(if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
|
|
|
|
];
|
2012-05-14 21:43:46 +00:00
|
|
|
};
|
2010-05-29 21:15:13 +00:00
|
|
|
};
|
2012-05-14 21:43:46 +00:00
|
|
|
|
zathura: improve overridability; set plugin dir through the environment
The current package setup has two issues:
* You can only access `pkgs.zathura` which is the "final" derivation,
i.e. a wrapper. This is a problem if you want to apply a patch to
`zathura(1)` in an overlay. To make this a bit easier, I decided to
expose `zathuraPkgs` entirely and `zathura` is now
`zathuraPkgs.zathuraWrapper`.
With this change, patches can now be added like this:
```
with import ./. {
overlays = [
(self: super: {
zathura = super.zathura.override {
zathura_core = super.zathuraPkgs.zathura_core.overrideAttrs (_: {
patches = [
~/Projects/zathura/0001-Fix-remote-link-resolution-in-zathura.patch
];
});
};
})
];
};
zathura
```
* As soon as you open another window in `zathura` from `zathura` (e.g.
to follow a PDF-embedded link to another PDF), it currently fails
because `--plugins-dir=` isn't passed along. This is because `zathura`
uses `argv[0]`[1] to open another process and the GApps-wrapper inside
`zathuraPkgs.zathura_core` does a `exec -a "$0"` which isn't the
`bin/zathura` from the wrapper that appends `--plugins-dir=`:
```
execve("/nix/var/nix/profiles/per-user/ma27/home-manager-140-link/home-path/bin/zathura", ["/nix/var/nix/profiles/per-user/ma27/home-manager-140-link/home-path/bin/zathura", "/home/ma27/Documents/Uni/Studium/Notepad/Aktuell/Index.pdf"], 0x7ffd7a4bf4b0 /* 108 vars */) = 0
execve("/nix/store/2wjhxbgzcnn0qqdwqy0m01hw39dxwfmk-zathura-0.4.8-bin/bin/zathura", ["/nix/store/2wjhxbgzcnn0qqdwqy0m01hw39dxwfmk-zathura-0.4.8-bin/bin/zathura", "--plugins-dir=/nix/store/wcch63yzwykc9x5393dzjfdxsf80mrb8-zathura-with-plugins-0.4.8/lib/zathura", "/home/ma27/Documents/Uni/Studium/Notepad/Aktuell/Index.pdf"], 0x1442010 /* 107 vars */) = 0
execve("/nix/store/2wjhxbgzcnn0qqdwqy0m01hw39dxwfmk-zathura-0.4.8-bin/bin/.zathura-wrapped", ["/nix/store/2wjhxbgzcnn0qqdwqy0m01hw39dxwfmk-zathura-0.4.8-bin/bin/zathura", "--plugins-dir=/nix/store/wcch63yzwykc9x5393dzjfdxsf80mrb8-zathura-with-plugins-0.4.8/lib/zathura", "/home/ma27/Documents/Uni/Studium/Notepad/Aktuell/Index.pdf"], 0x81d010 /* 108 vars */) = 0
```
I figured it's way simpler to actually use the environment variable
`ZATHURA_PLUGINS_PATH` for that purpose as the environment is
inherited when a new process is started.
[1] https://git.pwmt.org/pwmt/zathura/-/blob/242329b534af9cf04b423bf1e4fa7a7f8bac9030/zathura/links.c#L205-215
2022-02-05 01:35:39 +00:00
|
|
|
in self
|