diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml
index cd828dfc888..ffe8171171a 100644
--- a/nixos/doc/manual/release-notes/rl-unstable.xml
+++ b/nixos/doc/manual/release-notes/rl-unstable.xml
@@ -145,6 +145,26 @@ nginx.override {
from the ELPA, MELPA, and MELPA Stable repositories.
+
+
+ CUPS, installed by services.printing module, now
+ has its data directory in /var/lib/cups. Old
+ configurations from /etc/cups are moved there
+ automatically, but there might be problems. Also configuration options
+ services.printing.cupsdConf and
+ services.printing.cupsdFilesConf were removed
+ because they had been allowing one to override configuration variables
+ required for CUPS to work at all on NixOS. For most use cases,
+ services.printing.extraConf and new option
+ services.printing.extraFilesConf should be enough;
+ if you encounter a situation when they are not, please file a bug.
+
+ There are also Gutenprint improvements; in particular, a new option
+ services.printing.gutenprint is added to enable automatic
+ updating of Gutenprint PPMs; it's greatly recommended to enable it instead
+ of adding gutenprint to the drivers list.
+
+
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 010d44c40d1..cc7557c06eb 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -99,6 +99,8 @@ with lib;
(mkRemovedOptionModule [ "services" "syslog-ng" "listenToJournal" ])
(mkRemovedOptionModule [ "ec2" "metadata" ])
(mkRemovedOptionModule [ "services" "openvpn" "enable" ])
+ (mkRemovedOptionModule [ "services" "printing" "cupsFilesConf" ])
+ (mkRemovedOptionModule [ "services" "printing" "cupsdConf" ])
];
}
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 0fe25b66da0..98fb33e3256 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -4,10 +4,13 @@ with lib;
let
- inherit (pkgs) cups cups_filters;
+ inherit (pkgs) cups cups-pk-helper cups_filters gutenprint;
cfg = config.services.printing;
+ avahiEnabled = config.services.avahi.enable;
+ polkitEnabled = config.security.polkit.enable;
+
additionalBackends = pkgs.runCommand "additional-cups-backends" { }
''
mkdir -p $out
@@ -30,12 +33,75 @@ let
# cupsd.conf tells cupsd to use this tree.
bindir = pkgs.buildEnv {
name = "cups-progs";
- paths = cfg.drivers;
- pathsToLink = [ "/lib/cups" "/share/cups" "/bin" "/etc/cups" ];
+ paths =
+ [ cups additionalBackends cups_filters pkgs.ghostscript ]
+ ++ optional cfg.gutenprint gutenprint
+ ++ cfg.drivers;
+ pathsToLink = [ "/lib/cups" "/share/cups" "/bin" ];
postBuild = cfg.bindirCmds;
ignoreCollisions = true;
};
+ writeConf = name: text: pkgs.writeTextFile {
+ inherit name text;
+ destination = "/etc/cups/${name}";
+ };
+
+ cupsFilesFile = writeConf "cups-files.conf" ''
+ SystemGroup root wheel
+
+ ServerBin ${bindir}/lib/cups
+ DataDir ${bindir}/share/cups
+
+ AccessLog syslog
+ ErrorLog syslog
+ PageLog syslog
+
+ TempDir ${cfg.tempDir}
+
+ # User and group used to run external programs, including
+ # those that actually send the job to the printer. Note that
+ # Udev sets the group of printer devices to `lp', so we want
+ # these programs to run as `lp' as well.
+ User cups
+ Group lp
+
+ ${cfg.extraFilesConf}
+ '';
+
+ cupsdFile = writeConf "cupsd.conf" ''
+ ${concatMapStrings (addr: ''
+ Listen ${addr}
+ '') cfg.listenAddresses}
+ Listen /var/run/cups/cups.sock
+
+ SetEnv PATH ${bindir}/lib/cups/filter:${bindir}/bin
+
+ DefaultShared ${if cfg.defaultShared then "Yes" else "No"}
+
+ Browsing ${if cfg.browsing then "Yes" else "No"}
+
+ WebInterface ${if cfg.webInterface then "Yes" else "No"}
+
+ ${cfg.extraConf}
+ '';
+
+ browsedFile = writeConf "cups-browsed.conf" cfg.browsedConf;
+
+ rootdir = pkgs.buildEnv {
+ name = "cups-progs";
+ paths = [
+ cupsFilesFile
+ cupsdFile
+ (writeConf "client.conf" cfg.clientConf)
+ (writeConf "snmp.conf" cfg.snmpConf)
+ ] ++ optional avahiEnabled browsedFile
+ ++ optional cfg.gutenprint gutenprint
+ ++ cfg.drivers;
+ pathsToLink = [ "/etc/cups" ];
+ ignoreCollisions = true;
+ };
+
in
{
@@ -96,25 +162,11 @@ in
'';
};
- cupsdConf = mkOption {
- type = types.lines;
- default = "";
- example =
- ''
- BrowsePoll cups.example.com
- LogLevel debug
- '';
- description = ''
- The contents of the configuration file of the CUPS daemon
- (cupsd.conf).
- '';
- };
-
- cupsFilesConf = mkOption {
+ extraFilesConf = mkOption {
type = types.lines;
default = "";
description = ''
- The contents of the configuration file of the CUPS daemon
+ Extra contents of the configuration file of the CUPS daemon
(cups-files.conf).
'';
};
@@ -171,8 +223,18 @@ in
'';
};
+ gutenprint = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Gutenprint drivers for CUPS. This includes auto-updating
+ Gutenprint PPD files.
+ '';
+ };
+
drivers = mkOption {
type = types.listOf types.path;
+ default = [];
example = literalExample "[ pkgs.splix ]";
description = ''
CUPS drivers to use. Drivers provided by CUPS, cups-filters, Ghostscript
@@ -204,15 +266,10 @@ in
description = "CUPS printing services";
};
- environment.systemPackages = [ cups ];
+ environment.systemPackages = [ cups ] ++ optional polkitEnabled cups-pk-helper;
+ environment.etc."cups".source = "/var/lib/cups";
- environment.etc."cups/client.conf".text = cfg.clientConf;
- environment.etc."cups/cups-files.conf".text = cfg.cupsFilesConf;
- environment.etc."cups/cupsd.conf".text = cfg.cupsdConf;
- environment.etc."cups/cups-browsed.conf".text = cfg.browsedConf;
- environment.etc."cups/snmp.conf".text = cfg.snmpConf;
-
- services.dbus.packages = [ cups ];
+ services.dbus.packages = [ cups ] ++ optional polkitEnabled cups-pk-helper;
# Cups uses libusb to talk to printers, and does not use the
# linux kernel driver. If the driver is not in a black list, it
@@ -230,19 +287,35 @@ in
preStart =
''
- mkdir -m 0755 -p /etc/cups
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
mkdir -m 0755 -p ${cfg.tempDir}
- '';
- restartTriggers =
- [ config.environment.etc."cups/cups-files.conf".source
- config.environment.etc."cups/cupsd.conf".source
- ];
+ mkdir -m 0755 -p /var/lib/cups
+ # Backwards compatibility
+ if [ ! -L /etc/cups ]; then
+ mv /etc/cups/* /var/lib/cups
+ rmdir /etc/cups
+ ln -s /var/lib/cups /etc/cups
+ fi
+ # First, clean existing symlinks
+ if [ -n "$(ls /var/lib/cups)" ]; then
+ for i in /var/lib/cups/*; do
+ [ -L "$i" ] && rm "$i"
+ done
+ fi
+ # Then, populate it with static files
+ cd ${rootdir}/etc/cups
+ for i in *; do
+ [ ! -e "/var/lib/cups/$i" ] && ln -s "${rootdir}/etc/cups/$i" "/var/lib/cups/$i"
+ done
+ ${optionalString cfg.gutenprint ''
+ ${gutenprint}/bin/cups-genppdupdate
+ ''}
+ '';
};
- systemd.services.cups-browsed = mkIf config.services.avahi.enable
+ systemd.services.cups-browsed = mkIf avahiEnabled
{ description = "CUPS Remote Printer Discovery";
wantedBy = [ "multi-user.target" ];
@@ -255,54 +328,13 @@ in
serviceConfig.ExecStart = "${cups_filters}/bin/cups-browsed";
- restartTriggers =
- [ config.environment.etc."cups/cups-browsed.conf".source
- ];
+ restartTriggers = [ browsedFile ];
};
- services.printing.drivers =
- [ cups pkgs.ghostscript pkgs.cups_filters additionalBackends
- pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
- ];
-
- services.printing.cupsFilesConf =
- ''
- SystemGroup root wheel
-
- ServerBin ${bindir}/lib/cups
- DataDir ${bindir}/share/cups
-
- AccessLog syslog
- ErrorLog syslog
- PageLog syslog
-
- TempDir ${cfg.tempDir}
-
- # User and group used to run external programs, including
- # those that actually send the job to the printer. Note that
- # Udev sets the group of printer devices to `lp', so we want
- # these programs to run as `lp' as well.
- User cups
- Group lp
- '';
-
- services.printing.cupsdConf =
+ services.printing.extraConf =
''
LogLevel info
- ${concatMapStrings (addr: ''
- Listen ${addr}
- '') cfg.listenAddresses}
- Listen /var/run/cups/cups.sock
-
- SetEnv PATH ${bindir}/lib/cups/filter:${bindir}/bin:${bindir}/sbin
-
- DefaultShared ${if cfg.defaultShared then "Yes" else "No"}
-
- Browsing ${if cfg.browsing then "Yes" else "No"}
-
- WebInterface ${if cfg.webInterface then "Yes" else "No"}
-
DefaultAuthType Basic
@@ -343,8 +375,6 @@ in
Order deny,allow
-
- ${cfg.extraConf}
'';
security.pam.services.cups = {};
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index 954a1d4c19c..96d6dbd5285 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -27,6 +27,8 @@ stdenv.mkDerivation rec {
#configureFlags = [ "--disable-print" ];
+ enableParallelBuilding = true;
+
# "screenshot" needs this.
NIX_LDFLAGS = "-rpath ${xorg.libX11}/lib"
+ stdenv.lib.optionalString stdenv.isDarwin " -lintl";
diff --git a/pkgs/development/libraries/ijs/default.nix b/pkgs/development/libraries/ijs/default.nix
index fbba11c10c9..0c7d412fee6 100644
--- a/pkgs/development/libraries/ijs/default.nix
+++ b/pkgs/development/libraries/ijs/default.nix
@@ -1,16 +1,25 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ stdenv, fetchurl, fetchpatch, autoreconfHook }:
-let version = "9.16";
+let version = "9.18";
in
stdenv.mkDerivation {
name = "ijs-${version}";
src = fetchurl {
url = "http://downloads.ghostscript.com/public/ghostscript-${version}.tar.bz2";
- sha256 = "0vdqbjkickb0109lk6397bb2zjmg1s46dac5p5j4gfxa4pwl8b9y";
+ sha256 = "18ad90za28dxybajqwf3y3dld87cgkx1ljllmcnc7ysspfxzbnl3";
};
- prePatch = "cd ijs";
+ patches = [
+ # http://bugs.ghostscript.com/show_bug.cgi?id=696246
+ (fetchpatch {
+ name = "devijs-account-for-device-subclassing.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=b68e05c3";
+ sha256 = "1c3fzfjzvf15z533vpw3l3da8wcxw98qi3p1lc6lf13940a57c7n";
+ })
+ ];
+
+ postPatch = "cd ijs";
enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/libspectre/default.nix b/pkgs/development/libraries/libspectre/default.nix
index 0e5f976c122..5c10fff50ad 100644
--- a/pkgs/development/libraries/libspectre/default.nix
+++ b/pkgs/development/libraries/libspectre/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "1v63lqc6bhhxwkpa43qmz8phqs8ci4dhzizyy16d3vkb20m846z8";
};
+ patches = [ ./libspectre-0.2.7-gs918.patch ];
+
buildInputs = [
# Need `libgs.so'.
pkgconfig ghostscript cairo /*for tests*/
diff --git a/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch b/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch
new file mode 100644
index 00000000000..e9a4eda192b
--- /dev/null
+++ b/pkgs/development/libraries/libspectre/libspectre-0.2.7-gs918.patch
@@ -0,0 +1,42 @@
+Fixed error namespace for >=ghostscript-gpl-9.18
+
+https://bugs.gentoo.org/563540
+
+--- libspectre-0.2.7/libspectre/spectre-gs.c
++++ libspectre-0.2.7/libspectre/spectre-gs.c
+@@ -43,12 +43,12 @@
+
+ if (code <= -100) {
+ switch (code) {
+- case e_Fatal:
++ case gs_error_Fatal:
+ fprintf (stderr, "fatal internal error %d", code);
+ return TRUE;
+ break;
+
+- case e_ExecStackUnderflow:
++ case gs_error_ExecStackUnderflow:
+ fprintf (stderr, "stack overflow %d", code);
+ return TRUE;
+ break;
+@@ -109,9 +109,9 @@
+ set = _spectre_strdup_printf ("%d %d translate\n", -x, -y);
+ error = gsapi_run_string_continue (ghostscript_instance, set, strlen (set),
+ 0, &exit_code);
+- error = error == e_NeedInput ? 0 : error;
++ error = error == gs_error_NeedInput ? 0 : error;
+ free (set);
+- if (error != e_NeedInput && critic_error_code (error)) {
++ if (error != gs_error_NeedInput && critic_error_code (error)) {
+ fclose (fd);
+ return FALSE;
+ }
+@@ -126,7 +126,7 @@
+ read = fread (buf, sizeof (char), to_read, fd);
+ error = gsapi_run_string_continue (ghostscript_instance,
+ buf, read, 0, &exit_code);
+- error = error == e_NeedInput ? 0 : error;
++ error = error == gs_error_NeedInput ? 0 : error;
+ left -= read;
+ }
+
diff --git a/pkgs/development/libraries/qpdf/default.nix b/pkgs/development/libraries/qpdf/default.nix
index 340f4558f81..8f886421d55 100644
--- a/pkgs/development/libraries/qpdf/default.nix
+++ b/pkgs/development/libraries/qpdf/default.nix
@@ -1,13 +1,13 @@
{ stdenv, fetchurl, pcre, zlib, perl }:
-let version = "5.1.3";
+let version = "6.0.0";
in
stdenv.mkDerivation rec {
name = "qpdf-${version}";
src = fetchurl {
url = "mirror://sourceforge/qpdf/qpdf/${version}/${name}.tar.gz";
- sha256 = "1lq1v7xghvl6p4hgrwbps3a13ad6lh4ib3myimb83hxgsgd4n5nm";
+ sha256 = "0csj2p2gkxrc0rk8ykymlsdgfas96vzf1dip3y1x7z1q9plwgzd9";
};
nativeBuildInputs = [ perl ];
@@ -23,6 +23,7 @@ stdenv.mkDerivation rec {
'';
doCheck = true;
+ enableParallelBuilding = true;
meta = with stdenv.lib; {
homepage = http://qpdf.sourceforge.net/;
diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix
index 8fa111ecc02..7dedf26096d 100644
--- a/pkgs/misc/cups/default.nix
+++ b/pkgs/misc/cups/default.nix
@@ -3,7 +3,7 @@
, libusb ? null, gnutls ? null, avahi ? null, libpaper ? null
}:
-let version = "2.0.4"; in
+let version = "2.1.2"; in
with stdenv.lib;
stdenv.mkDerivation {
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://www.cups.org/software/${version}/cups-${version}-source.tar.bz2";
- sha256 = "1gaakz24k6x5nc09rmpiq0xq20j1qdjc3szag8qwmyi4ky6ydmg1";
+ sha256 = "1bc1y8fjgh54ryh520gk63i5rbagn6jijsrskcqlibhfm0xwmc5s";
};
buildInputs = [ pkgconfig zlib libjpeg libpng libtiff libusb gnutls libpaper ]
@@ -51,7 +51,6 @@ stdenv.mkDerivation {
# Idem for /etc.
"PAMDIR=$(out)/etc/pam.d"
"DBUSDIR=$(out)/etc/dbus-1"
- "INITDIR=$(out)/etc/rc.d"
"XINETD=$(out)/etc/xinetd.d"
"SERVERROOT=$(out)/etc/cups"
# Idem for /usr.
@@ -61,6 +60,8 @@ stdenv.mkDerivation {
"CUPS_PRIMARY_SYSTEM_GROUP=root"
];
+ enableParallelBuilding = true;
+
postInstall = ''
# Delete obsolete stuff that conflicts with cups-filters.
rm -rf $out/share/cups/banners $out/share/cups/data/testprint
diff --git a/pkgs/misc/cups/filters.nix b/pkgs/misc/cups/filters.nix
index b4b3a5a0624..7118511f16d 100644
--- a/pkgs/misc/cups/filters.nix
+++ b/pkgs/misc/cups/filters.nix
@@ -1,26 +1,24 @@
-{ stdenv, fetchurl, fetchpatch, pkgconfig, cups, poppler, poppler_utils, fontconfig
-, libjpeg, libpng, perl, ijs, qpdf, dbus, substituteAll, bash, avahi }:
+{ stdenv, fetchurl, pkgconfig, cups, poppler, poppler_utils, fontconfig
+, libjpeg, libpng, perl, ijs, qpdf, dbus, substituteAll, bash, avahi
+, makeWrapper, coreutils, gnused, bc, gawk, gnugrep, which
+}:
-stdenv.mkDerivation rec {
+let
+ binPath = stdenv.lib.makeSearchPath "bin" [ coreutils gnused bc gawk gnugrep which ];
+
+in stdenv.mkDerivation rec {
name = "cups-filters-${version}";
- version = "1.0.71";
+ version = "1.5.0";
src = fetchurl {
url = "http://openprinting.org/download/cups-filters/${name}.tar.xz";
- sha256 = "07wwlqcykfjfqcwj1bxk60ggahyaw7wcx32n5s104d1qkhham01i";
+ sha256 = "0cjrh4wpdhkvmahfkg8f2a2qzilcq12i78q5arwr7dnmx1j8hapj";
};
- patches = [
- ./longer-shell-path.patch
- (fetchpatch { # drop on update
- name = "poppler-0.34.patch";
- url = "https://bugs.linuxfoundation.org/attachment.cgi?id=493";
- sha256 = "18za83q0b0n4hpvvw76jsv0hm89zmijvps2z5kg1srickqlxj891";
- })
- ];
+ nativeBuildInputs = [ pkgconfig makeWrapper ];
buildInputs = [
- pkgconfig cups poppler poppler_utils fontconfig libjpeg libpng perl
+ cups poppler poppler_utils fontconfig libjpeg libpng perl
ijs qpdf dbus avahi
];
@@ -29,9 +27,10 @@ stdenv.mkDerivation rec {
"--enable-imagefilters"
"--with-rcdir=no"
"--with-shell=${stdenv.shell}"
+ "--with-test-font-path=/path-does-not-exist"
];
- makeFlags = "CUPS_SERVERBIN=$(out)/lib/cups CUPS_DATADIR=$(out)/share/cups CUPS_SERVERROOT=$(out)/etc/cups";
+ makeFlags = [ "CUPS_SERVERBIN=$(out)/lib/cups" "CUPS_DATADIR=$(out)/share/cups" "CUPS_SERVERROOT=$(out)/etc/cups" ];
postConfigure =
''
@@ -46,11 +45,13 @@ stdenv.mkDerivation rec {
postInstall =
''
- for i in $out/lib/cups/filter/{pstopdf,texttops,imagetops}; do
- substituteInPlace $i --replace 'which ' 'type -p '
+ for i in $out/lib/cups/filter/*; do
+ wrapProgram "$i" --prefix PATH ':' ${binPath}
done
'';
+ enableParallelBuilding = true;
+
meta = {
homepage = http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters;
description = "Backends, filters, and other software that was once part of the core CUPS distribution but is no longer maintained by Apple Inc";
diff --git a/pkgs/misc/cups/longer-shell-path.patch b/pkgs/misc/cups/longer-shell-path.patch
deleted file mode 100644
index 397cc681732..00000000000
--- a/pkgs/misc/cups/longer-shell-path.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/filter/foomatic-rip/foomaticrip.c b/filter/foomatic-rip/foomaticrip.c
-index 90a851c..689a2bd 100644
---- a/filter/foomatic-rip/foomaticrip.c
-+++ b/filter/foomatic-rip/foomaticrip.c
-@@ -174,7 +174,7 @@ char cupsfilterpath[PATH_MAX] = "/usr/local/lib/cups/filter:"
- "/opt/cups/filter:"
- "/usr/lib/cups/filter";
-
--char modern_shell[64] = SHELL;
-+char modern_shell[] = SHELL;
-
- void config_set_option(const char *key, const char *value)
- {
diff --git a/pkgs/misc/drivers/gutenprint/default.nix b/pkgs/misc/drivers/gutenprint/default.nix
index 98776c0c42b..5be7f5ecff4 100644
--- a/pkgs/misc/drivers/gutenprint/default.nix
+++ b/pkgs/misc/drivers/gutenprint/default.nix
@@ -1,78 +1,41 @@
# this package was called gimp-print in the past
-{ fetchurl, stdenv, pkgconfig, composableDerivation, cups
-, libtiff, libpng, makeWrapper, openssl, gimp }:
+{ stdenv, lib, fetchurl, pkgconfig
+, ijs, makeWrapper
+, gimp2Support ? true, gimp
+, cupsSupport ? true, cups, libusb, perl
+}:
-let
- version = "5.2.10";
- inherit (composableDerivation) edf wwf;
-in
-
-composableDerivation.composableDerivation {} {
- name = "gutenprint-${version}";
+stdenv.mkDerivation rec {
+ name = "gutenprint-5.2.11";
src = fetchurl {
- url = "mirror://sourceforge/gimp-print/gutenprint-${version}.tar.bz2";
- sha256 = "0n8f6vpadnagrp6yib3mca1c3lgwl4vmma16s44riyrd84mka7s3";
+ url = "mirror://sourceforge/gimp-print/${name}.tar.bz2";
+ sha256 = "1yadw96rgp1z0jv1wxrz6cds36nb693w3xlv596xw9r5w394r8y1";
};
- # gimp, gui is still not working (TODO)
- buildInputs = [ makeWrapper openssl pkgconfig ];
+ nativeBuildInputs = [ makeWrapper pkgconfig ];
+ buildInputs =
+ [ ijs ]
+ ++ lib.optionals gimp2Support [ gimp.gtk gimp ]
+ ++ lib.optionals cupsSupport [ cups libusb perl ];
- configureFlags = ["--enable-static-genppd"];
- NIX_CFLAGS_COMPILE="-include stdio.h";
-
- #preConfigure = ''
- # configureFlags="--with-cups=$out/usr-cups $configureFlags"
- #'';
-
- /*
- is this recommended? without it this warning is printed:
+ configureFlags = lib.optionals cupsSupport [
+ "--disable-static-genppd" # should be harmless on NixOS
+ ];
- ***WARNING: Use of --disable-static-genppd or --disable-static
- when building CUPS is very dangerous. The build may
- fail when building the PPD files, or may *SILENTLY*
- build incorrect PPD files or cause other problems.
- Please review the README and release notes carefully!
- */
+ enableParallelBuilding = true;
- installPhase = ''
- eval "make install $installArgs"
- mkdir -p $out/lib/cups
- ln -s $out/filter $out/lib/cups/
- wrapProgram $out/filter/rastertogutenprint.5.2 --prefix LD_LIBRARY_PATH : $out/lib
- wrapProgram $out/sbin/cups-genppd.5.2 --prefix LD_LIBRARY_PATH : $out/lib
- '';
+ # Testing is very, very long.
+ # doCheck = true;
- meta = {
+ installFlags =
+ lib.optionals cupsSupport [ "cups_conf_datadir=$(out)/share/cups" "cups_conf_serverbin=$(out)/lib/cups" "cups_conf_serverroot=$(out)/etc/cups" ]
+ ++ lib.optionals gimp2Support [ "gimp2_plug_indir=$(out)/${gimp.name}-plugins" ];
+
+ meta = with stdenv.lib; {
description = "Ghostscript and cups printer drivers";
homepage = http://sourceforge.net/projects/gimp-print/;
- license = "GPL";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
};
-
- mergeAttrBy = { installArgs = stdenv.lib.concat; };
-
- # most interpreters aren't tested yet.. (see python for example how to do it)
- flags =
- wwf {
- name = "gimp2";
- enable = {
- buildInputs = [gimp gimp.gtk];
- installArgs = [ "gimp2_plug_indir=$out/${gimp.name}-plugins" ];
- };
- }
- // {
- cups = {
- set = {
- buildInputs = [cups libtiff libpng ];
- installArgs = [ "cups_conf_datadir=$out cups_conf_serverbin=$out cups_conf_serverroot=$out"];
- };
- };
- }
- ;
-
- cfg = {
- gimp2Support = true;
- cupsSupport = true;
- };
-
}
diff --git a/pkgs/misc/ghostscript/CVE-2015-3228.patch b/pkgs/misc/ghostscript/CVE-2015-3228.patch
deleted file mode 100644
index 7be18b0a730..00000000000
--- a/pkgs/misc/ghostscript/CVE-2015-3228.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description: Sanity check for memory allocation.
- In gs_heap_alloc_bytes(), add a sanity check to ensure we don't overflow the
- variable holding the actual number of bytes we allocate.
-Origin: upstream, http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0c0b085
-Author: Chris Liddell
-Forwarded: yes
-Bug-Debian: http://bugs.debian.org/793489
-Last-Update: 2015-07-26
-
---- a/base/gsmalloc.c
-+++ b/base/gsmalloc.c
-@@ -178,7 +178,7 @@
- } else {
- uint added = size + sizeof(gs_malloc_block_t);
-
-- if (mmem->limit - added < mmem->used)
-+ if (added <= size || mmem->limit - added < mmem->used)
- set_msg("exceeded limit");
- else if ((ptr = (byte *) Memento_label(malloc(added), cname)) == 0)
- set_msg("failed");
diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix
index 53b5caf9312..658fa346f1e 100644
--- a/pkgs/misc/ghostscript/default.nix
+++ b/pkgs/misc/ghostscript/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkgconfig, zlib, expat, openssl
+{ stdenv, fetchurl, fetchpatch, pkgconfig, zlib, expat, openssl, autoconf
, libjpeg, libpng, libtiff, freetype, fontconfig, lcms2, libpaper, jbig2dec
-, libiconv
+, libiconv, ijs
, x11Support ? false, xlibsWrapper ? null
, cupsSupport ? false, cups ? null
}:
@@ -8,8 +8,8 @@
assert x11Support -> xlibsWrapper != null;
assert cupsSupport -> cups != null;
let
- version = "9.15";
- sha256 = "0p1isp6ssfay141klirn7n9s8b546vcz6paksfmksbwy0ljsypg6";
+ version = "9.18";
+ sha256 = "18ad90za28dxybajqwf3y3dld87cgkx1ljllmcnc7ysspfxzbnl3";
fonts = stdenv.mkDerivation {
name = "ghostscript-fonts";
@@ -45,28 +45,58 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
+ nativeBuildInputs = [ pkgconfig autoconf ];
buildInputs =
- [ pkgconfig zlib expat openssl
+ [ zlib expat openssl
libjpeg libpng libtiff freetype fontconfig lcms2 libpaper jbig2dec
- libiconv
+ libiconv ijs
]
++ stdenv.lib.optional x11Support xlibsWrapper
++ stdenv.lib.optional cupsSupport cups
- # [] # maybe sometimes jpeg2000 support
;
patches = [
./urw-font-files.patch
- # fetched from debian's ghostscript 9.15_dfsg-1 (called 020150707~0c0b085.patch there)
- ./CVE-2015-3228.patch
+ # http://bugs.ghostscript.com/show_bug.cgi?id=696281
+ (fetchpatch {
+ name = "fix-check-for-using-shared-freetype-lib.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
+ sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
+ })
+ # http://bugs.ghostscript.com/show_bug.cgi?id=696301
+ (fetchpatch {
+ name = "add-gserrors.h-to-the-installed-files.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=feafe5e5";
+ sha256 = "0s4ayzakjv809dkn7vilxwvs4dw35p3pw942ml91bk9z4kkaxyz7";
+ })
+ # http://bugs.ghostscript.com/show_bug.cgi?id=696246
+ (fetchpatch {
+ name = "guard-against-NULL-base-for-non-clist-devices.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=007bd77d08d800e6b07274d62e3c91be7c4a3f47";
+ sha256 = "1la53273agl92lpy7qd0qhgzynx8b90hrk8g9jsj3055ssn6rqwh";
+ })
+ (fetchpatch {
+ name = "ensure-plib-devices-always-use-the-clist.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=1bdbe4f87dc57648821e613ebcc591b84e8b35b3";
+ sha256 = "1cq83fgyvrycapxm69v4r9f9qhzsr40ygrc3bkp8pk15wsmvq0k7";
+ })
+ (fetchpatch {
+ name = "prevent-rinkj-device-crash-when-misconfigured.patch";
+ url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=5571ddfa377c5d7d98f55af40e693814ac287ae4";
+ sha256 = "08iqdlrngi6k0ml2b71dj5q136fyp1s9g0rr87ayyshn0k0lxwkv";
+ })
];
makeFlags = [ "cups_serverroot=$(out)" "cups_serverbin=$(out)/lib/cups" ];
preConfigure = ''
- rm -rf jpeg libpng zlib jasper expat tiff lcms{,2} jbig2dec openjpeg freetype cups/libs
+ # requires in-tree (heavily patched) openjpeg
+ rm -rf jpeg libpng zlib jasper expat tiff lcms{,2} jbig2dec freetype cups/libs ijs
sed "s@if ( test -f \$(INCLUDE)[^ ]* )@if ( true )@; s@INCLUDE=/usr/include@INCLUDE=/no-such-path@" -i base/unix-aux.mak
+ sed "s@^ZLIBDIR=.*@ZLIBDIR=${zlib}/include@" -i configure.ac
+
+ autoconf
'';
configureFlags =
diff --git a/pkgs/tools/misc/system-config-printer/default.nix b/pkgs/tools/misc/system-config-printer/default.nix
index 6b0be9d2f6e..7ed25fb549b 100644
--- a/pkgs/tools/misc/system-config-printer/default.nix
+++ b/pkgs/tools/misc/system-config-printer/default.nix
@@ -5,16 +5,20 @@
, withGUI ? true
}:
-stdenv.mkDerivation rec {
- name = "system-config-printer-1.3.12";
+let majorVersion = "1.5";
+
+in stdenv.mkDerivation rec {
+ name = "system-config-printer-${majorVersion}.7";
src = fetchurl {
- url = "http://cyberelk.net/tim/data/system-config-printer/1.3/${name}.tar.xz";
+ url = "http://cyberelk.net/tim/data/system-config-printer/${majorVersion}/${name}.tar.xz";
sha256 = "1cg9n75rg5l9vr1925n2g771kga33imikyl0mf70lww2sfgvs18r";
};
propagatedBuildInputs = [ pythonPackages.pycurl ];
+ patches = [ ./detect_serverbindir.patch ];
+
buildInputs =
[ intltool pkgconfig glib udev libusb1 cups xmlto
libxml2 docbook_xml_dtd_412 docbook_xsl desktop_file_utils
@@ -32,17 +36,28 @@ stdenv.mkDerivation rec {
postInstall =
''
+ export makeWrapperArgs="--set prefix $out"
wrapPythonPrograms
+ # The program imports itself, so we need to move shell wrappers to a proper place.
+ fixupWrapper() {
+ mv "$out/share/system-config-printer/$2.py" \
+ "$out/bin/$1"
+ sed -i "s/.$2.py-wrapped/$2.py/g" "$out/bin/$1"
+ mv "$out/share/system-config-printer/.$2.py-wrapped" \
+ "$out/share/system-config-printer/$2.py"
+ }
+ fixupWrapper scp-dbus-service scp-dbus-service
+ fixupWrapper system-config-printer system-config-printer
+ fixupWrapper system-config-printer-applet applet
+ # This __init__.py is both executed and imported.
( cd $out/share/system-config-printer/troubleshoot
mv .__init__.py-wrapped __init__.py
)
-
- # Upstream issue: https://github.com/twaugh/system-config-printer/issues/28
- sed -i -e "s|/usr/bin|$out/bin|" "$out/share/dbus-1/services/org.fedoraproject.Config.Printing.service"
'';
meta = {
homepage = http://cyberelk.net/tim/software/system-config-printer/;
platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/tools/misc/system-config-printer/detect_serverbindir.patch b/pkgs/tools/misc/system-config-printer/detect_serverbindir.patch
new file mode 100644
index 00000000000..2cd3058f233
--- /dev/null
+++ b/pkgs/tools/misc/system-config-printer/detect_serverbindir.patch
@@ -0,0 +1,17 @@
+diff --git a/cupshelpers/config.py.in b/cupshelpers/config.py.in
+index 55abbfc..1244327 100644
+--- a/cupshelpers/config.py.in
++++ b/cupshelpers/config.py.in
+@@ -22,3 +22,12 @@
+ prefix="@prefix@"
+ sysconfdir="@sysconfdir@"
+ cupsserverbindir="@cupsserverbindir@"
++
++try:
++ with open("/etc/cups/cups-files.conf") as config:
++ for cfgline in config:
++ args = cfgline.split(" ")
++ if len(args) == 2 and args[0] == "ServerBin":
++ cupsserverbindir = args[1].strip()
++except OSError:
++ pass