Merge pull request #65040 from matthewbauer/cups-fixes

nixos/cups fixes
This commit is contained in:
Matthew Bauer 2019-08-14 11:52:11 -04:00 committed by GitHub
commit 1af546a929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 12 deletions

View File

@ -254,6 +254,15 @@
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.
</para>
</listitem>
<listitem>
<para>
The CUPS Printing service now uses socket-based activation by
default, only starting when needed. The previous behavior can
be restored by setting
<option>services.cups.startWhenNeeded</option> to
<literal>false</literal>.
</para>
</listitem>
</itemizedlist>
</section>

View File

@ -127,7 +127,7 @@ in
startWhenNeeded = mkOption {
type = types.bool;
default = false;
default = true;
description = ''
If set, CUPS is socket-activated; that is,
instead of having it permanently running as a daemon,
@ -296,11 +296,16 @@ in
# gets loaded, and then cups cannot access the printers.
boot.blacklistedKernelModules = [ "usblp" ];
# Some programs like print-manager rely on this value to get
# printer test pages.
environment.sessionVariables.CUPS_DATADIR = "${bindir}/share/cups";
systemd.packages = [ cups.out ];
systemd.sockets.cups = mkIf cfg.startWhenNeeded {
wantedBy = [ "sockets.target" ];
listenStreams = map (x: replaceStrings ["localhost"] ["127.0.0.1"] (removePrefix "*:" x)) cfg.listenAddresses;
listenStreams = [ "/run/cups/cups.sock" ]
++ map (x: replaceStrings ["localhost"] ["127.0.0.1"] (removePrefix "*:" x)) cfg.listenAddresses;
};
systemd.services.cups =
@ -362,10 +367,10 @@ in
{ description = "CUPS Remote Printer Discovery";
wantedBy = [ "multi-user.target" ];
wants = [ "cups.service" "avahi-daemon.service" ];
bindsTo = [ "cups.service" "avahi-daemon.service" ];
partOf = [ "cups.service" "avahi-daemon.service" ];
after = [ "cups.service" "avahi-daemon.service" ];
wants = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
bindsTo = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
partOf = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
after = [ "avahi-daemon.service" ] ++ optional (!cfg.startWhenNeeded) "cups.service";
path = [ cups ];
@ -421,4 +426,7 @@ in
security.pam.services.cups = {};
};
meta.maintainers = with lib.maintainers; [ matthewbauer ];
}

View File

@ -3,7 +3,7 @@
import ./make-test.nix ({pkgs, ... }: {
name = "printing";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ domenkozar eelco ];
maintainers = [ domenkozar eelco matthewbauer ];
};
nodes = {
@ -34,10 +34,6 @@ import ./make-test.nix ({pkgs, ... }: {
''
startAll;
# Make sure that cups is up on both sides.
$server->waitForUnit("cups.service");
$client->waitForUnit("cups.service");
$client->sleep(10); # wait until cups is fully initialized
$client->succeed("lpstat -r") =~ /scheduler is running/ or die;
# check local encrypted connections work without error
$client->succeed("lpstat -E -r") =~ /scheduler is running/ or die;

View File

@ -133,7 +133,7 @@ stdenv.mkDerivation rec {
homepage = https://cups.org/;
description = "A standards-based printing system for UNIX";
license = licenses.gpl2; # actually LGPL for the library and GPL for the rest
maintainers = with maintainers; [ ];
maintainers = with maintainers; [ matthewbauer ];
platforms = platforms.unix;
};
}