2022-07-13 21:58:42 +00:00
|
|
|
{ lib
|
|
|
|
, autoPatchelfHook
|
|
|
|
, cpio
|
|
|
|
, freetype
|
|
|
|
, zlib
|
|
|
|
, openssl
|
|
|
|
, fetchurl
|
2024-07-16 12:50:03 +00:00
|
|
|
, dpkg
|
2022-07-13 21:58:42 +00:00
|
|
|
, gcc-unwrapped
|
2024-07-16 12:50:03 +00:00
|
|
|
, libjpeg
|
2022-07-13 21:58:42 +00:00
|
|
|
, libpng
|
|
|
|
, fontconfig
|
|
|
|
, stdenv
|
|
|
|
, xar
|
|
|
|
, xorg
|
|
|
|
}:
|
2021-11-03 19:57:08 +00:00
|
|
|
|
2022-07-13 21:58:42 +00:00
|
|
|
let
|
|
|
|
darwinAttrs = rec {
|
|
|
|
version = "0.12.6-2";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg";
|
|
|
|
sha256 = "sha256-gaZrd7UI/t6NvKpnEnIDdIN2Vos2c6F/ZhG21R6YlPg=";
|
|
|
|
};
|
2021-11-03 19:57:08 +00:00
|
|
|
|
2022-07-13 21:58:42 +00:00
|
|
|
nativeBuildInputs = [ xar cpio ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
xar -xf $src
|
|
|
|
zcat Payload | cpio -i
|
|
|
|
tar -xf usr/local/share/wkhtmltox-installer/wkhtmltox.tar.gz
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-07-19 16:17:07 +00:00
|
|
|
runHook preInstall
|
2022-07-13 21:58:42 +00:00
|
|
|
mkdir -p $out
|
|
|
|
cp -r bin include lib share $out/
|
2022-07-19 16:17:07 +00:00
|
|
|
runHook postInstall
|
2022-07-13 21:58:42 +00:00
|
|
|
'';
|
2021-11-03 19:57:08 +00:00
|
|
|
};
|
|
|
|
|
2024-09-04 07:13:09 +00:00
|
|
|
_linuxAttrs = {
|
2024-07-16 12:50:03 +00:00
|
|
|
nativeBuildInputs = [ dpkg autoPatchelfHook ];
|
2021-11-03 19:57:08 +00:00
|
|
|
|
2022-07-13 21:58:42 +00:00
|
|
|
buildInputs = [
|
|
|
|
xorg.libXext
|
|
|
|
xorg.libXrender
|
|
|
|
|
|
|
|
freetype
|
|
|
|
openssl
|
|
|
|
zlib
|
|
|
|
|
|
|
|
(lib.getLib fontconfig)
|
|
|
|
(lib.getLib gcc-unwrapped)
|
2024-07-16 12:50:03 +00:00
|
|
|
(lib.getLib libjpeg)
|
2022-07-13 21:58:42 +00:00
|
|
|
(lib.getLib libpng)
|
|
|
|
];
|
|
|
|
|
2024-07-16 12:50:03 +00:00
|
|
|
unpackPhase = ''
|
|
|
|
runHook preUnpack
|
|
|
|
|
|
|
|
mkdir pkg
|
|
|
|
dpkg-deb -x $src pkg
|
|
|
|
|
|
|
|
runHook postUnpack
|
|
|
|
'';
|
2022-07-13 21:58:42 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2022-07-19 16:17:07 +00:00
|
|
|
runHook preInstall
|
2024-07-16 12:50:03 +00:00
|
|
|
|
|
|
|
cp -r pkg/usr/local $out
|
|
|
|
|
2022-07-19 16:17:07 +00:00
|
|
|
runHook postInstall
|
2022-07-13 21:58:42 +00:00
|
|
|
'';
|
|
|
|
};
|
2024-09-04 07:13:09 +00:00
|
|
|
|
|
|
|
linuxAttrs.aarch64-linux = rec {
|
|
|
|
version = "0.12.6.1-3";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox_${version}.bookworm_arm64.deb";
|
|
|
|
hash = "sha256-tmBhV7J8E+BE0Ku+ZwMB+I3k4Xgq/KT5wGpYF/PgOpw=";
|
|
|
|
};
|
|
|
|
} // _linuxAttrs;
|
|
|
|
|
|
|
|
linuxAttrs.x86_64-linux = rec {
|
|
|
|
version = "0.12.6.1-3";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox_${version}.bookworm_amd64.deb";
|
|
|
|
hash = "sha256-mLoNFXtQ028jvQ3t9MCqKMewxQ/NzcVKpba7uoGjlB0=";
|
|
|
|
};
|
|
|
|
} // _linuxAttrs;
|
2022-07-13 21:58:42 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
2024-07-17 14:14:05 +00:00
|
|
|
pname = "wkhtmltopdf";
|
2021-11-03 19:57:08 +00:00
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/wkhtmltopdf --version
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://wkhtmltopdf.org/";
|
|
|
|
description =
|
|
|
|
"Tools for rendering web pages to PDF or images (binary package)";
|
|
|
|
longDescription = ''
|
|
|
|
wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools
|
|
|
|
to render HTML into PDF and various image formats using the QT Webkit
|
|
|
|
rendering engine. These run entirely "headless" and do not require a
|
|
|
|
display or display service.
|
|
|
|
|
|
|
|
There is also a C library, if you're into that kind of thing.
|
|
|
|
'';
|
|
|
|
license = licenses.gpl3Plus;
|
2022-07-19 16:12:45 +00:00
|
|
|
maintainers = with maintainers; [ nbr kalbasit ];
|
2024-09-04 07:13:09 +00:00
|
|
|
platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux" ];
|
2021-11-03 19:57:08 +00:00
|
|
|
};
|
|
|
|
}
|
2022-07-13 21:58:42 +00:00
|
|
|
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin) darwinAttrs
|
2024-09-04 07:13:09 +00:00
|
|
|
// lib.optionalAttrs (stdenv.hostPlatform.isLinux) linuxAttrs.${stdenv.system}
|
2022-07-13 21:58:42 +00:00
|
|
|
)
|