wkhtmltopdf-bin: add support for Linux

+74 -21
+71 -20
pkgs/tools/graphics/wkhtmltopdf-bin/default.nix
··· 1 - { stdenv, lib, fetchurl, wkhtmltopdf, xar, cpio }: 1 + { lib 2 + , autoPatchelfHook 3 + , cpio 4 + , freetype 5 + , zlib 6 + , openssl 7 + , dpkg 8 + , fetchurl 9 + , gcc-unwrapped 10 + , libjpeg8 11 + , libpng 12 + , fontconfig 13 + , stdenv 14 + , wkhtmltopdf 15 + , xar 16 + , xorg 17 + }: 2 18 3 - stdenv.mkDerivation rec { 19 + let 20 + darwinAttrs = rec { 21 + version = "0.12.6-2"; 22 + src = fetchurl { 23 + url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg"; 24 + sha256 = "sha256-gaZrd7UI/t6NvKpnEnIDdIN2Vos2c6F/ZhG21R6YlPg="; 25 + }; 4 26 5 - pname = "wkhtmltopdf-bin"; 6 - version = "0.12.6-1"; 7 - sha256 = "1db59kdprzpmvdj1bg47lmfgi3zlvzvqif11sbym9hw61xy6gp3d"; 8 - src = fetchurl { 9 - url = 10 - "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg"; 11 - inherit sha256; 27 + nativeBuildInputs = [ xar cpio ]; 28 + 29 + unpackPhase = '' 30 + xar -xf $src 31 + zcat Payload | cpio -i 32 + tar -xf usr/local/share/wkhtmltox-installer/wkhtmltox.tar.gz 33 + ''; 34 + 35 + installPhase = '' 36 + mkdir -p $out 37 + cp -r bin include lib share $out/ 38 + ''; 12 39 }; 13 40 14 - buildInputs = [ xar cpio ]; 41 + linuxAttrs = rec { 42 + version = "0.12.6-3"; 43 + src = fetchurl { 44 + url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.archlinux-x86_64.pkg.tar.xz"; 45 + sha256 = "sha256-6Ewu8sPRbqvYWj27mBlQYpEN+mb+vKT46ljrdEUxckI="; 46 + }; 47 + 48 + nativeBuildInputs = [ autoPatchelfHook ]; 49 + 50 + buildInputs = [ 51 + xorg.libXext 52 + xorg.libXrender 53 + 54 + freetype 55 + openssl 56 + zlib 57 + 58 + (lib.getLib fontconfig) 59 + (lib.getLib gcc-unwrapped) 60 + (lib.getLib libjpeg8) 61 + (lib.getLib libpng) 62 + ]; 15 63 16 - unpackPhase = '' 17 - xar -xf $src 18 - zcat Payload | cpio -i 19 - tar -xf usr/local/share/wkhtmltox-installer/wkhtmltox.tar.gz 20 - ''; 64 + unpackPhase = "tar -xf $src"; 21 65 22 - installPhase = '' 23 - mkdir -p $out 24 - cp -r bin include lib share $out/ 25 - ''; 66 + installPhase = '' 67 + mkdir -p $out 68 + cp -r usr/bin usr/include usr/lib usr/share $out/ 69 + ''; 70 + }; 71 + in 72 + stdenv.mkDerivation ({ 73 + pname = "wkhtmltopdf-bin"; 26 74 27 75 dontStrip = true; 28 76 ··· 46 94 ''; 47 95 license = licenses.gpl3Plus; 48 96 maintainers = with maintainers; [ nbr ]; 49 - platforms = [ "x86_64-darwin" ]; 97 + platforms = [ "x86_64-darwin" "x86_64-linux" ]; 50 98 }; 51 99 } 100 + // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) darwinAttrs 101 + // lib.optionalAttrs (stdenv.hostPlatform.isLinux) linuxAttrs 102 + )
+3 -1
pkgs/top-level/all-packages.nix
··· 12027 12027 12028 12028 wkhtmltopdf = libsForQt514.callPackage ../tools/graphics/wkhtmltopdf { }; 12029 12029 12030 - wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { }; 12030 + wkhtmltopdf-bin = callPackage ../tools/graphics/wkhtmltopdf-bin { 12031 + libjpeg8 = libjpeg.override { enableJpeg8 = true; }; 12032 + }; 12031 12033 12032 12034 wml = callPackage ../development/web/wml { }; 12033 12035