Skip to content

Commit

Permalink
cups-filters: 1.28.17 -> 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
raboof committed Nov 26, 2024
1 parent 23e89b7 commit 401db4b
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 52 deletions.
8 changes: 5 additions & 3 deletions nixos/modules/services/printing/cupsd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ with lib;

let

inherit (pkgs) cups-pk-helper cups-filters xdg-utils;
inherit (pkgs) cups-pk-helper libcupsfilters cups-filters xdg-utils;

cfg = config.services.printing;
cups = cfg.package;
Expand Down Expand Up @@ -35,7 +35,7 @@ let
bindir = pkgs.buildEnv {
name = "cups-progs";
paths =
[ cups.out additionalBackends cups-filters pkgs.ghostscript ]
[ cups.out additionalBackends libcupsfilters cups-filters pkgs.ghostscript ]
++ cfg.drivers;
pathsToLink = [ "/lib" "/share/cups" "/bin" ];
postBuild = cfg.bindirCmds;
Expand Down Expand Up @@ -278,6 +278,8 @@ in
'';
};

browsed.package = lib.mkPackageOption pkgs "cups-browsed" {};

browsedConf = mkOption {
type = types.lines;
default = "";
Expand Down Expand Up @@ -438,7 +440,7 @@ in

path = [ cups ];

serviceConfig.ExecStart = "${cups-filters}/bin/cups-browsed";
serviceConfig.ExecStart = "${cfg.browsed.package}/bin/cups-browsed";

restartTriggers = [ browsedFile ];
};
Expand Down
47 changes: 47 additions & 0 deletions pkgs/by-name/cu/cups-browsed/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
autoreconfHook,
avahi,
cups,
fetchFromGitHub,
glib,
lib,
libcupsfilters,
libppd,
pkg-config,
stdenv,
}:

stdenv.mkDerivation rec {
pname = "cups-browsed";
version = "2.1.0";

src = fetchFromGitHub {
owner = "OpenPrinting";
repo = "cups-browsed";
rev = version;
hash = "sha256-UkPJqVWG6obIW0jGXsnnYB2lmIm/uiMuPYSGY3+M4Gw=";
};

nativeBuildInputs = [
autoreconfHook
pkg-config
cups
];

buildInputs = [
avahi
libcupsfilters
libppd
glib
];

configureFlags = [
"--with-rcdir=no"
];

makeFlags = [
"CUPS_SERVERBIN=$(out)/lib/cups"
"CUPS_DATADIR=$(out)/share/cups"
"CUPS_SERVERROOT=$(out)/etc/cups"
];
}
64 changes: 64 additions & 0 deletions pkgs/by-name/li/libcupsfilters/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
autoreconfHook,
cups,
dbus,
dejavu_fonts,
fetchFromGitHub,
fontconfig,
ghostscript,
lcms2,
libexif,
libjpeg,
libpng,
libtiff,
mupdf,
pkg-config,
poppler,
poppler_utils,
qpdf,
stdenv,
}:

stdenv.mkDerivation rec {
pname = "libcupsfilters";
version = "2.1.0";

src = fetchFromGitHub {
owner = "OpenPrinting";
repo = "libcupsfilters";
rev = "2.1.0";
hash = "sha256-tnQqM4stUJseDO9BG+PRUSFafjgpQQklTDsDsB9zQ4Y=";
};

nativeBuildInputs = [
autoreconfHook
pkg-config
cups
];
buildInputs = [
dbus
fontconfig
ghostscript
lcms2
libexif
libjpeg
libpng
libtiff
mupdf
poppler
poppler_utils
qpdf
];
configureFlags = [
"--with-mutool-path=${mupdf}/bin/mutool"
"--with-gs-path=${ghostscript}/bin/gs"
"--with-ippfind-path=${cups}/bin/ippfind"
"--enable-imagefilters"
"--with-test-font-path=${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf"
];
makeFlags = [
"CUPS_SERVERBIN=$(out)/lib/cups"
"CUPS_DATADIR=$(out)/share/cups"
"CUPS_SERVERROOT=$(out)/etc/cups"
];
}
48 changes: 48 additions & 0 deletions pkgs/by-name/li/libppd/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
autoreconfHook,
cups,
fetchFromGitHub,
ghostscript,
libcupsfilters,
libz,
mupdf,
pkg-config,
poppler_utils,
stdenv,
}:

stdenv.mkDerivation rec {
pname = "libppd";
version = "2.1.0";

src = fetchFromGitHub {
owner = "OpenPrinting";
repo = "libppd";
rev = version;
hash = "sha256-vT4h3dnMu4yHNk0ExGZjuChdu0kAcxsla7vJupZpLaY=";
};

nativeBuildInputs = [
autoreconfHook
pkg-config
cups
];
buildInputs = [
ghostscript
libcupsfilters
mupdf
libz
];
configureFlags = [
"--with-mutool-path=${mupdf}/bin/mutool"
"--with-pdftops=pdftops"
"--with-pdftops-path=${poppler_utils}/bin/pdftops"
"--with-gs-path=${ghostscript}/bin/gs"
"--with-pdftocairo-path=${poppler_utils}/bin/pdftocairo"
];
makeFlags = [
"CUPS_SERVERBIN=$(out)/lib/cups"
"CUPS_DATADIR=$(out)/share/cups"
"CUPS_SERVERROOT=$(out)/etc/cups"
];
}
63 changes: 17 additions & 46 deletions pkgs/misc/cups/filters.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{ lib
, avahi
, bc
, coreutils
, cups
, dbus
, dejavu_fonts
, fetchurl
, fetchpatch
, fetchFromGitHub
, fontconfig
, gawk
, ghostscript
, gnugrep
, gnused
, ijs
, libcupsfilters
, libppd
, libexif
, libjpeg
, liblouis
Expand All @@ -30,70 +30,41 @@
, withAvahi ? true
}:

let
(if !withAvahi then lib.warn "the 'withAvahi' parameter to 'cups-filters' is deprecated, as the cops-browsed component (which does not make sense without avahi) has been split out of the cups-filters package (which no longer needs avahi)" else lib.id)

(let
binPath = lib.makeBinPath [ bc coreutils gawk gnused gnugrep which ];

in
stdenv.mkDerivation rec {
pname = "cups-filters";
version = "1.28.17";
version = "2.0.1";

src = fetchurl {
url = "https://github.com/OpenPrinting/cups-filters/releases/download/${version}/${pname}-${version}.tar.xz";
hash = "sha256-Jwo3UqlgNoqpnUMftdNPQDmyrJQ8V22EBhLR2Bhcm7k=";
src = fetchFromGitHub {
owner = "OpenPrinting";
repo = "cups-filters";
rev = version;
hash = "sha256-bLOl64bdeZ10JLcQ7GbU+VffJu3Lzo0ves7O7GQIOWY=";
};

patches = [
(fetchpatch {
name = "CVE-2023-24805.patch";
url = "https://github.com/OpenPrinting/cups-filters/commit/93e60d3df358c0ae6f3dba79e1c9684657683d89.patch";
hash = "sha256-KgWTYFr2uShL040azzE+KaNyBPy7Gs/hCnEgQmmPCys=";
})
(fetchpatch {
name = "CVE-2024-47076.patch";
url = "https://github.com/OpenPrinting/libcupsfilters/commit/95576ec3d20c109332d14672a807353cdc551018.patch";
hash = "sha256-MXWllrdWt8n7zqvumQNg34dBgWMwMTwf9lrD+ZZP8Wk=";
})
(fetchpatch {
name = "remove-cups-ldap-browse-protocols_CVE-2024-47176_CVE-2024-47850.patch";
url = "https://github.com/OpenPrinting/cups-filters/commit/6fd2bdfbdce76149af531ce9fca9062304238451.patch";
hash = "sha256-XS1ODy7i7ilgEjsKuEvOUiRN9pqsj+bOktKoshKcg8Q=";
})
];

nativeBuildInputs = [ pkg-config makeWrapper autoreconfHook ];

buildInputs = [
cups
dbus
fontconfig
ghostscript
ijs
libexif
libjpeg
liblouis # braille embosser support
libpng
libcupsfilters
libppd
mupdf
perl
poppler
poppler_utils
qpdf
] ++ lib.optionals withAvahi [ avahi ];
];

configureFlags = [
"--with-mutool-path=${mupdf}/bin/mutool"
"--with-pdftops=pdftops"
"--with-pdftops-path=${poppler_utils}/bin/pdftops"
"--with-gs-path=${ghostscript}/bin/gs"
"--with-pdftocairo-path=${poppler_utils}/bin/pdftocairo"
"--with-ippfind-path=${cups}/bin/ippfind"
"--enable-imagefilters"
"--with-rcdir=no"
"--with-shell=${stdenv.shell}"
"--with-test-font-path=${dejavu_fonts}/share/fonts/truetype/DejaVuSans.ttf"
"--localstatedir=/var"
"--sysconfdir=/etc"
] ++ lib.optionals (!withAvahi) [ "--disable-avahi" ];
];

makeFlags = [ "CUPS_SERVERBIN=$(out)/lib/cups" "CUPS_DATADIR=$(out)/share/cups" "CUPS_SERVERROOT=$(out)/etc/cups" ];

Expand Down Expand Up @@ -130,4 +101,4 @@ stdenv.mkDerivation rec {
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
};
}
})
4 changes: 2 additions & 2 deletions pkgs/tools/misc/system-config-printer/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, docbook_xml_dtd_412, docbook_xsl
, libxml2, desktop-file-utils, libusb1, cups, gdk-pixbuf, pango, atk, libnotify
, gobject-introspection, libsecret, packagekit
, cups-filters, gettext, libtool, autoconf-archive
, libcupsfilters, gettext, libtool, autoconf-archive
, python3Packages, autoreconfHook, bash, fetchpatch
}:

Expand Down Expand Up @@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
buildPythonPath "$out $pythonPath"
gappsWrapperArgs+=(
--prefix PATH : "$program_PATH"
--set CUPS_DATADIR "${cups-filters}/share/cups"
--set CUPS_DATADIR "${libcupsfilters}/share/cups"
)
find $out/share/system-config-printer -name \*.py -type f -perm -0100 -print0 | while read -d "" f; do
Expand Down
8 changes: 7 additions & 1 deletion pkgs/top-level/perl-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18677,7 +18677,13 @@ with self; {
url = "mirror://cpan/authors/id/N/NI/NINE/Net-CUPS-0.64.tar.gz";
hash = "sha256-17x3/w9iv4dMhDxZDrEqgLvUR0mi+3Tb7URcNdDoWoU=";
};
buildInputs = [ pkgs.cups pkgs.cups-filters ];
patches = [
(fetchpatch {
url = "https://git.launchpad.net/ubuntu/+source/libnet-cups-perl/plain/debian/patches/cupsfilters-2.0.patch?id=a47b8df8551853c12a7f965ae60bb52333883c88";
hash = "sha256-ouOrUsRHD1qxu8B6rZiqs9LXYIymX5kSuu99KnmP8Bo=";
})
];
buildInputs = [ pkgs.cups pkgs.libcupsfilters ];
NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.cups}/lib -lcups";
meta = {
description = "Common Unix Printing System Interface";
Expand Down

0 comments on commit 401db4b

Please sign in to comment.