diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 78251b3721a7..543522c534b4 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -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; @@ -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; @@ -278,6 +278,8 @@ in ''; }; + browsed.package = lib.mkPackageOption pkgs "cups-browsed" {}; + browsedConf = mkOption { type = types.lines; default = ""; @@ -436,7 +438,7 @@ in path = [ cups ]; - serviceConfig.ExecStart = "${cups-filters}/bin/cups-browsed"; + serviceConfig.ExecStart = "${cfg.browsed.package}/bin/cups-browsed"; restartTriggers = [ browsedFile ]; }; diff --git a/pkgs/by-name/cu/cups-browsed/package.nix b/pkgs/by-name/cu/cups-browsed/package.nix new file mode 100644 index 000000000000..66564ac60053 --- /dev/null +++ b/pkgs/by-name/cu/cups-browsed/package.nix @@ -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" + ]; +} diff --git a/pkgs/by-name/li/libcupsfilters/package.nix b/pkgs/by-name/li/libcupsfilters/package.nix new file mode 100644 index 000000000000..dfd17f890c47 --- /dev/null +++ b/pkgs/by-name/li/libcupsfilters/package.nix @@ -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" + ]; +} diff --git a/pkgs/by-name/li/libppd/package.nix b/pkgs/by-name/li/libppd/package.nix new file mode 100644 index 000000000000..39383430208c --- /dev/null +++ b/pkgs/by-name/li/libppd/package.nix @@ -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" + ]; +} diff --git a/pkgs/misc/cups/filters.nix b/pkgs/misc/cups/filters.nix index d5688d3bc351..e4f44dbf2947 100644 --- a/pkgs/misc/cups/filters.nix +++ b/pkgs/misc/cups/filters.nix @@ -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 @@ -30,70 +30,41 @@ , withAvahi ? true }: -let +(if !withAvahi then lib.warn "the 'withAvahi' parameter to 'cups-filters' is deprecated, as the cups-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" ]; @@ -130,4 +101,4 @@ stdenv.mkDerivation rec { license = lib.licenses.gpl2Plus; platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/tools/misc/system-config-printer/default.nix b/pkgs/tools/misc/system-config-printer/default.nix index c94f94f55f2e..595882b9b500 100644 --- a/pkgs/tools/misc/system-config-printer/default.nix +++ b/pkgs/tools/misc/system-config-printer/default.nix @@ -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 }: @@ -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 diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 975a666524b4..4adf1b10a3ed 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -18679,7 +18679,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";