lol

cups-pdf-to-pdf: init at unstable-2021-12-22

Note that cups-pdf refuses to run without root privileges.
To use the binary, one has to either convince cups to
call it with root privileges, or install it suid root.

Also note that currently, this cups-pdf-fork produces
small pdfs with selectable text, as promised.
However, copying the text produces "garbled" text
(characters are randomly reassigned).
This is a known issue and I don't know how to fix it:

https://github.com/alexivkin/CUPS-PDF-to-PDF/issues/7

Yarny0 56bc902b 2787fc7d

+61
+59
pkgs/misc/cups/drivers/cups-pdf-to-pdf/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , cups 5 + , coreutils 6 + }: 7 + 8 + stdenv.mkDerivation rec { 9 + pname = "cups-pdf-to-pdf"; 10 + version = "unstable-2021-12-22"; 11 + 12 + src = fetchFromGitHub { 13 + owner = "alexivkin"; 14 + repo = "CUPS-PDF-to-PDF"; 15 + rev = "c14428c2ca8e95371daad7db6d11c84046b1a2d4"; 16 + hash = "sha256-pa4PFf8OAFSra0hSazmKUfbMYL/cVWvYA1lBf7c7jmY="; 17 + }; 18 + 19 + buildInputs = [ cups ]; 20 + 21 + postPatch = '' 22 + sed -r 's|(gscall, size, ")cp |\1${coreutils}/bin/cp |' cups-pdf.c -i 23 + ''; 24 + 25 + # gcc command line is taken from original cups-pdf's README file 26 + # https://fossies.org/linux/cups-pdf/README 27 + # however, we replace gcc with $CC following 28 + # https://nixos.org/manual/nixpkgs/stable/#sec-darwin 29 + buildPhase = '' 30 + runHook preBuild 31 + $CC -O9 -s cups-pdf.c -o cups-pdf -lcups 32 + runHook postBuild 33 + ''; 34 + 35 + installPhase = '' 36 + runHook preInstall 37 + install -Dt $out/lib/cups/backend cups-pdf 38 + install -Dm 0644 -t $out/etc/cups cups-pdf.conf 39 + install -Dm 0644 -t $out/share/cups/model *.ppd 40 + runHook postInstall 41 + ''; 42 + 43 + meta = with lib; { 44 + description = "A CUPS backend that turns print jobs into searchable PDF files"; 45 + homepage = "https://github.com/alexivkin/CUPS-PDF-to-PDF"; 46 + license = licenses.gpl2Only; 47 + maintainers = [ maintainers.yarny ]; 48 + longDescription = '' 49 + cups-pdf is a CUPS backend that generates a PDF file for each print job and puts this file 50 + into a folder on the local machine such that the print job's owner can access the file. 51 + 52 + https://www.cups-pdf.de/ 53 + 54 + cups-pdf-to-pdf is a fork of cups-pdf which tries hard to preserve the original text of the print job by avoiding rasterization. 55 + 56 + Note that in order to use this package, you have to make sure that the cups-pdf program is called with root privileges. 57 + ''; 58 + }; 59 + }
+2
pkgs/top-level/all-packages.nix
··· 36497 36497 36498 36498 cups-dymo = callPackage ../misc/cups/drivers/dymo {}; 36499 36499 36500 + cups-pdf-to-pdf = callPackage ../misc/cups/drivers/cups-pdf-to-pdf {}; 36501 + 36500 36502 cups-toshiba-estudio = callPackage ../misc/cups/drivers/estudio {}; 36501 36503 36502 36504 cups-zj-58 = callPackage ../misc/cups/drivers/zj-58 { };