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 13:17:31 +02:00
{ lib
, stdenv
2022-04-08 14:04:59 +02:00
, installShellFiles
2022-04-03 13:17:31 +02:00
, fetchFromGitHub
2022-08-07 04:41:04 +02:00
, freetype
2022-04-03 13:17:31 +02:00
, gumbo
, harfbuzz
, jbig2dec
2022-07-19 07:44:42 +02:00
, mujs
2022-04-03 13:17:31 +02:00
, mupdf
, openjpeg
, qt3d
, qtbase
2022-04-10 12:48:12 +02:00
, qmake
2022-04-03 13:17:31 +02:00
, wrapQtAppsHook
}:
2022-09-04 20:16:24 +02:00
stdenv.mkDerivation (finalAttrs: {
2022-04-03 13:17:31 +02:00
pname = "sioyek";
version = "unstable-2022-08-30";
2022-04-03 13:17:31 +02:00
src = fetchFromGitHub {
owner = "ahrm";
2022-09-04 20:16:24 +02:00
repo = "sioyek";
rev = "8d0a63484334e2cb2b0571a07a3875e6ab6c8916";
sha256 = "sha256-29Wxg/VVQPDDzzxKcvMa1+rtiP4bDkPAB/JJsj+F+WQ=";
2022-04-03 13:17:31 +02:00
};
2022-09-04 20:16:24 +02:00
buildInputs = [
gumbo
harfbuzz
jbig2dec
mujs
mupdf
openjpeg
qt3d
qtbase
]
++ lib.optionals stdenv.isDarwin [ freetype ];
2022-04-03 13:17:31 +02:00
2022-09-04 20:16:24 +02:00
nativeBuildInputs = [
installShellFiles
qmake
wrapQtAppsHook
];
2022-04-03 13:17:31 +02:00
2022-08-07 04:41:04 +02:00
qmakeFlags = lib.optionals stdenv.isDarwin [ "CONFIG+=non_portable" ];
2022-04-10 12:48:12 +02:00
postPatch = ''
2022-08-07 04:41:04 +02:00
substituteInPlace pdf_viewer_build_config.pro \
--replace "-lmupdf-threads" "-lgumbo -lharfbuzz -lfreetype -ljbig2dec -ljpeg -lopenjp2"
2022-04-10 12:48:12 +02:00
substituteInPlace pdf_viewer/main.cpp \
--replace "/usr/share/sioyek" "$out/share" \
2022-04-10 12:58:57 +02:00
--replace "/etc/sioyek" "$out/etc"
2022-04-03 13:17:31 +02:00
'';
2022-08-07 04:41:04 +02: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
cp -r sioyek.app $out/Applications
2022-09-04 20:16:24 +02:00
'' else ''
2022-04-10 12:48:12 +02: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 13:17:31 +02:00
installManPage resources/sioyek.1
'';
meta = with lib; {
homepage = "https://sioyek.info/";
2022-09-04 20:16:24 +02:00
description = "A PDF viewer designed for research papers and technical books";
changelog = "https://github.com/ahrm/sioyek/releases/tag/v1.5.0";
2022-04-03 13:17:31 +02:00
license = licenses.gpl3Only;
2022-09-04 20:16:24 +02:00
maintainers = with maintainers; [ podocarp ];
platforms = platforms.unix;
broken = stdenv.isDarwin && stdenv.isAarch64;
2022-04-03 13:17:31 +02:00
};
2022-09-04 20:16:24 +02:00
})