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

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

83 lines
2.0 KiB
Nix
Raw Normal View History

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