From 569d5e544acb22499debe1b6d2481b4d831a8cc8 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 16 Jul 2024 14:24:24 +0200 Subject: [PATCH 1/3] wkhtmltopdf: use the -bin version wkhtmltopdf is a bit cursed. 1. It needs a specially patched version of QT to work. 2. It doesn't build currently. 3. Upstream repos are archived. 4. It depends on insecure dependencies. In the mid term this dependency should be removed, but it's still a hard dependency for: * bookstack * monica * odoo (ref https://github.com/odoo/odoo/issues/86501) * snipe-it Instead of spending time to fix the build issues, use the -bin version in the meantime. --- pkgs/tools/graphics/wkhtmltopdf/default.nix | 57 --------------------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 - 3 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 pkgs/tools/graphics/wkhtmltopdf/default.nix diff --git a/pkgs/tools/graphics/wkhtmltopdf/default.nix b/pkgs/tools/graphics/wkhtmltopdf/default.nix deleted file mode 100644 index 7f1e40a695e4..000000000000 --- a/pkgs/tools/graphics/wkhtmltopdf/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ stdenv, lib, fetchFromGitHub, qtwebkit, qtsvg, qtxmlpatterns -, fontconfig, freetype, libpng, zlib, libjpeg, wrapQtAppsHook -, openssl, libX11, libXext, libXrender }: - -stdenv.mkDerivation rec { - version = "0.12.6"; - pname = "wkhtmltopdf"; - - src = fetchFromGitHub { - owner = "wkhtmltopdf"; - repo = "wkhtmltopdf"; - rev = version; - sha256 = "0m2zy986kzcpg0g3bvvm815ap9n5ann5f6bdy7pfj6jv482bm5mg"; - }; - - nativeBuildInputs = [ - wrapQtAppsHook - ]; - - buildInputs = [ - fontconfig freetype libpng zlib libjpeg openssl - libX11 libXext libXrender - qtwebkit qtsvg qtxmlpatterns - ]; - - prePatch = '' - for f in src/image/image.pro src/pdf/pdf.pro ; do - substituteInPlace $f --replace '$(INSTALL_ROOT)' "" - done - ''; - - # rewrite library path - postInstall = lib.optionalString stdenv.isDarwin '' - install_name_tool -change libwkhtmltox.0.dylib $out/lib/libwkhtmltox.0.dylib $out/bin/wkhtmltopdf - install_name_tool -change libwkhtmltox.0.dylib $out/lib/libwkhtmltox.0.dylib $out/bin/wkhtmltoimage - ''; - - configurePhase = "qmake wkhtmltopdf.pro INSTALLBASE=$out"; - - enableParallelBuilding = true; - - meta = with lib; { - homepage = "https://wkhtmltopdf.org/"; - description = "Tools for rendering web pages to PDF or images"; - 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; - maintainers = with maintainers; [ jb55 ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 6c770b905b48..55df99bd5981 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1471,6 +1471,7 @@ mapAliases ({ waypoint = throw "waypoint has been removed from nixpkgs as the upstream project was archived"; # Added 2024-04-24 wcm = throw "'wcm' has been renamed to/replaced by 'wayfirePlugins.wcm'"; # Add 2023-07-29 webkitgtk_5_0 = throw "'webkitgtk_5_0' has been superseded by 'webkitgtk_6_0'"; # Added 2023-02-25 + wkhtmltopdf = wkhtmltopdf-bin; wineWayland = wine-wayland; win-qemu = throw "'win-qemu' has been replaced by 'virtio-win'"; # Added 2023-08-16 win-virtio = virtio-win; # Added 2023-10-17 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5fbca08484c9..473de7c58b40 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14432,8 +14432,6 @@ with pkgs; wireguard-go = callPackage ../tools/networking/wireguard-go { }; - wkhtmltopdf = libsForQt5.callPackage ../tools/graphics/wkhtmltopdf { }; - wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { openssl = openssl_1_1; }; From d8db11eeb6ae2663b0758d46b98b9d4991749e05 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 16 Jul 2024 14:50:03 +0200 Subject: [PATCH 2/3] wkhtmktopdf-bin: 0.12.6-3 -> 0.12.6.1-3 Use the latest release before the project was archived. Removes dependency on openssl_1_1 which is marked as insecure, so this package should be built by Hydra once again. --- .../graphics/wkhtmltopdf-bin/default.nix | 27 ++++++++++++------- pkgs/top-level/all-packages.nix | 4 +-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/graphics/wkhtmltopdf-bin/default.nix b/pkgs/tools/graphics/wkhtmltopdf-bin/default.nix index 29e1d391958f..f63022a9a7c2 100644 --- a/pkgs/tools/graphics/wkhtmltopdf-bin/default.nix +++ b/pkgs/tools/graphics/wkhtmltopdf-bin/default.nix @@ -5,8 +5,9 @@ , zlib , openssl , fetchurl +, dpkg , gcc-unwrapped -, libjpeg8 +, libjpeg , libpng , fontconfig , stdenv @@ -39,13 +40,13 @@ let }; linuxAttrs = rec { - version = "0.12.6-3"; + version = "0.12.6.1-3"; src = fetchurl { - url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.archlinux-x86_64.pkg.tar.xz"; - sha256 = "sha256-6Ewu8sPRbqvYWj27mBlQYpEN+mb+vKT46ljrdEUxckI="; + url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox_${version}.bookworm_amd64.deb"; + hash = "sha256-mLoNFXtQ028jvQ3t9MCqKMewxQ/NzcVKpba7uoGjlB0="; }; - nativeBuildInputs = [ autoPatchelfHook ]; + nativeBuildInputs = [ dpkg autoPatchelfHook ]; buildInputs = [ xorg.libXext @@ -57,16 +58,24 @@ let (lib.getLib fontconfig) (lib.getLib gcc-unwrapped) - (lib.getLib libjpeg8) + (lib.getLib libjpeg) (lib.getLib libpng) ]; - unpackPhase = "tar -xf $src"; + unpackPhase = '' + runHook preUnpack + + mkdir pkg + dpkg-deb -x $src pkg + + runHook postUnpack + ''; installPhase = '' runHook preInstall - mkdir -p $out - cp -r usr/bin usr/include usr/lib usr/share $out/ + + cp -r pkg/usr/local $out + runHook postInstall ''; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 473de7c58b40..5b964c81d0e7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14432,9 +14432,7 @@ with pkgs; wireguard-go = callPackage ../tools/networking/wireguard-go { }; - wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { - openssl = openssl_1_1; - }; + wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { }; wml = callPackage ../development/web/wml { }; From a4673b4f6d29a31d9a14557a18838e3e6266a0de Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 16 Jul 2024 14:57:58 +0200 Subject: [PATCH 3/3] fixup! wkhtmltopdf: use the -bin version --- pkgs/top-level/aliases.nix | 1 - pkgs/top-level/all-packages.nix | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 55df99bd5981..6c770b905b48 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1471,7 +1471,6 @@ mapAliases ({ waypoint = throw "waypoint has been removed from nixpkgs as the upstream project was archived"; # Added 2024-04-24 wcm = throw "'wcm' has been renamed to/replaced by 'wayfirePlugins.wcm'"; # Add 2023-07-29 webkitgtk_5_0 = throw "'webkitgtk_5_0' has been superseded by 'webkitgtk_6_0'"; # Added 2023-02-25 - wkhtmltopdf = wkhtmltopdf-bin; wineWayland = wine-wayland; win-qemu = throw "'win-qemu' has been replaced by 'virtio-win'"; # Added 2023-08-16 win-virtio = virtio-win; # Added 2023-10-17 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5b964c81d0e7..7b6569b97b4e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14433,6 +14433,7 @@ with pkgs; wireguard-go = callPackage ../tools/networking/wireguard-go { }; wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { }; + wkhtmltopdf = wkhtmltopdf-bin; wml = callPackage ../development/web/wml { };