nixpkgs/pkgs/applications/misc/sioyek/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.1 KiB
Nix
Raw Normal View History

2022-04-03 11:17:31 +00:00
{ lib
, stdenv
2022-04-08 12:04:59 +00:00
, installShellFiles
2022-04-03 11:17:31 +00:00
, fetchFromGitHub
2022-08-07 02:41:04 +00:00
, freetype
2022-04-03 11:17:31 +00:00
, gumbo
, harfbuzz
, jbig2dec
2022-07-19 05:44:42 +00:00
, mujs
2022-04-03 11:17:31 +00:00
, mupdf
, openjpeg
, qt3d
, qtbase
2022-04-10 10:48:12 +00:00
, qmake
2022-04-03 11:17:31 +00:00
, wrapQtAppsHook
}:
2022-09-04 18:16:24 +00:00
stdenv.mkDerivation (finalAttrs: {
2022-04-03 11:17:31 +00:00
pname = "sioyek";
2022-12-16 17:27:49 +00:00
version = "2.0.0";
2022-04-03 11:17:31 +00:00
src = fetchFromGitHub {
owner = "ahrm";
2022-09-04 18:16:24 +00:00
repo = "sioyek";
2022-12-16 17:27:49 +00:00
rev = "v${finalAttrs.version}";
sha256 = "sha256-GFZaTXJhoBB+rSe7Qk6H6FZJVXr3nO9XgM+LAbS4te4=";
2022-04-03 11:17:31 +00:00
};
2022-09-04 18:16:24 +00:00
buildInputs = [
gumbo
harfbuzz
jbig2dec
mujs
mupdf
openjpeg
qt3d
qtbase
]
++ lib.optionals stdenv.isDarwin [ freetype ];
2022-04-03 11:17:31 +00:00
2022-09-04 18:16:24 +00:00
nativeBuildInputs = [
installShellFiles
qmake
wrapQtAppsHook
];
2022-04-03 11:17:31 +00:00
2022-08-07 02:41:04 +00:00
qmakeFlags = lib.optionals stdenv.isDarwin [ "CONFIG+=non_portable" ];
2022-04-10 10:48:12 +00:00
postPatch = ''
2022-08-07 02:41:04 +00:00
substituteInPlace pdf_viewer_build_config.pro \
--replace "-lmupdf-threads" "-lgumbo -lharfbuzz -lfreetype -ljbig2dec -ljpeg -lopenjp2"
2022-04-10 10:48:12 +00:00
substituteInPlace pdf_viewer/main.cpp \
--replace "/usr/share/sioyek" "$out/share" \
2022-04-10 10:58:57 +00:00
--replace "/etc/sioyek" "$out/etc"
2022-04-03 11:17:31 +00:00
'';
2022-08-07 02:41:04 +00:00
postInstall = if stdenv.isDarwin then ''
cp -r pdf_viewer/shaders sioyek.app/Contents/MacOS/shaders
cp pdf_viewer/prefs.config sioyek.app/Contents/MacOS/
cp pdf_viewer/prefs_user.config sioyek.app/Contents/MacOS/
cp pdf_viewer/keys.config sioyek.app/Contents/MacOS/
cp pdf_viewer/keys_user.config sioyek.app/Contents/MacOS/
cp tutorial.pdf sioyek.app/Contents/MacOS/
mkdir -p $out/Applications $out/bin
2022-08-07 02:41:04 +00:00
cp -r sioyek.app $out/Applications
ln -s $out/Applications/sioyek.app/Contents/MacOS/sioyek $out/bin/sioyek
2022-09-04 18:16:24 +00:00
'' else ''
2022-04-10 10:48:12 +00:00
install -Dm644 tutorial.pdf $out/share/tutorial.pdf
cp -r pdf_viewer/shaders $out/share/
install -Dm644 -t $out/etc/ pdf_viewer/{keys,prefs}.config
2022-04-03 11:17:31 +00:00
installManPage resources/sioyek.1
'';
meta = with lib; {
homepage = "https://sioyek.info/";
2022-09-04 18:16:24 +00:00
description = "A PDF viewer designed for research papers and technical books";
2022-12-16 17:27:49 +00:00
changelog = "https://github.com/ahrm/sioyek/releases/tag/v${finalAttrs.version}";
2022-04-03 11:17:31 +00:00
license = licenses.gpl3Only;
2022-09-04 18:16:24 +00:00
maintainers = with maintainers; [ podocarp ];
platforms = platforms.unix;
2022-04-03 11:17:31 +00:00
};
2022-09-04 18:16:24 +00:00
})