git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #65040 from matthewbauer/cups-fixes

nixos/cups fixes

commit1af546a9297775e948d45b973bde7419501ef587 authorMatthew Bauer <mjbauer95@gmail.com> dateWed 14 Aug 2019, 11:52 (7 years ago) parentdd49cf7e9b7085
4 files changed+25−12
nixos/doc/manual/release-notes/rl-1909.xml+9 nixos/modules/services/printing/cupsd.nix+14−6 nixos/tests/printing.nix+1−5 pkgs/misc/cups/default.nix+1−1
nixos/doc/manual/release-notes/rl-1909.xml+9
@@ -254,6 +254,15 @@
254254 If IBus support in Qt 4.x applications is required, add the <literal>ibus-qt</literal> package to your <xref linkend="opt-environment.systemPackages" /> manually.
255255 </para>
256256 </listitem>
257+ <listitem>
258+ <para>
259+ The CUPS Printing service now uses socket-based activation by
260+ default, only starting when needed. The previous behavior can
261+ be restored by setting
262+ <option>services.cups.startWhenNeeded</option> to
263+ <literal>false</literal>.
264+ </para>
265+ </listitem>
257266 </itemizedlist>
258267 </section>
259268
nixos/modules/services/printing/cupsd.nix+14−6
@@ -127,7 +127,7 @@ in
127127
128128 startWhenNeeded = mkOption {
129129 type = types.bool;
130− default = false;
130+ default = true;
131131 description = ''
132132 If set, CUPS is socket-activated; that is,
133133 instead of having it permanently running as a daemon,
@@ -296,11 +296,16 @@ in
296296 # gets loaded, and then cups cannot access the printers.
297297 boot.blacklistedKernelModules = [ "usblp" ];
298298
299+ # Some programs like print-manager rely on this value to get
300+ # printer test pages.
301+ environment.sessionVariables.CUPS_DATADIR = "${bindir}/share/cups";
302+
299303 systemd.packages = [ cups.out ];
300304
301305 systemd.sockets.cups = mkIf cfg.startWhenNeeded {
302306 wantedBy = [ "sockets.target" ];
303− listenStreams = map (x: replaceStrings ["localhost"] ["127.0.0.1"] (removePrefix "*:" x)) cfg.listenAddresses;
307+ listenStreams = [ "/run/cups/cups.sock" ]
308+ ++ map (x: replaceStrings ["localhost"] ["127.0.0.1"] (removePrefix "*:" x)) cfg.listenAddresses;
304309 };
305310
306311 systemd.services.cups =
@@ -362,10 +367,10 @@ in
362367 { description = "CUPS Remote Printer Discovery";
363368
364369 wantedBy = [ "multi-user.target" ];
365− wants = [ "cups.service" "avahi-daemon.service" ];
366− bindsTo = [ "cups.service" "avahi-daemon.service" ];
367− partOf = [ "cups.service" "avahi-daemon.service" ];
368− after = [ "cups.service" "avahi-daemon.service" ];
370+ wants = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
371+ bindsTo = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
372+ partOf = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
373+ after = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
369374
370375 path = [ cups ];
371376
@@ -421,4 +426,7 @@ in
421426 security.pam.services.cups = {};
422427
423428 };
429+
430+ meta.maintainers = with lib.maintainers; [ matthewbauer ];
431+
424432}
nixos/tests/printing.nix+1−5
@@ -3,7 +3,7 @@
33import ./make-test.nix ({pkgs, ... }: {
44 name = "printing";
55 meta = with pkgs.stdenv.lib.maintainers; {
6− maintainers = [ domenkozar eelco ];
6+ maintainers = [ domenkozar eelco matthewbauer ];
77 };
88
99 nodes = {
@@ -34,10 +34,6 @@ import ./make-test.nix ({pkgs, ... }: {
3434 ''
3535 startAll;
3636
37− # Make sure that cups is up on both sides.
38− $server->waitForUnit("cups.service");
39− $client->waitForUnit("cups.service");
40− $client->sleep(10); # wait until cups is fully initialized
4137 $client->succeed("lpstat -r") =~ /scheduler is running/ or die;
4238 # check local encrypted connections work without error
4339 $client->succeed("lpstat -E -r") =~ /scheduler is running/ or die;
pkgs/misc/cups/default.nix+1−1
@@ -133,7 +133,7 @@ stdenv.mkDerivation rec {
133133 homepage = https://cups.org/;
134134 description = "A standards-based printing system for UNIX";
135135 license = licenses.gpl2; # actually LGPL for the library and GPL for the rest
136− maintainers = with maintainers; [ ];
136+ maintainers = with maintainers; [ matthewbauer ];
137137 platforms = platforms.unix;
138138 };
139139}