* Add a configuration option `services.printing.cupsdConf' to allow

appending verbatim text to the CUPS daemon configuration file.
* cupsd.conf: set ErrorLog properly.

svn path=/nixos/trunk/; revision=20954
This commit is contained in:
Eelco Dolstra 2010-04-06 11:57:15 +00:00
parent 02e4a78c71
commit 755ee8bd08

View File

@ -40,8 +40,82 @@ let
${cfg.bindirCmds}
''; # */
in
cupsdConfig = pkgs.writeText "cupsd.conf"
{
###### interface
options = {
services.printing = {
enable = mkOption {
default = false;
description = ''
Whether to enable printing support through the CUPS daemon.
'';
};
bindirCmds = mkOption {
default = "";
description = ''
Additional commands executed while creating the directory
containing the CUPS server binaries.
'';
};
cupsdConf = mkOption {
default = "";
description = ''
The contents of the configuration file of the CUPS daemon
(<filename>cupsd.conf</filename>).
'';
};
};
};
###### implementation
config = mkIf config.services.printing.enable {
environment.systemPackages = [cups];
services.dbus.packages = [cups];
environment.etc =
[ # CUPS expects the following files in its ServerRoot.
{ source = "${cups}/etc/cups/mime.convs";
target = "cups/mime.convs";
}
{ source = "${cups}/etc/cups/mime.types";
target = "cups/mime.types";
}
];
jobs.cupsd =
{ description = "CUPS printing daemon";
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
preStart =
''
mkdir -m 0755 -p ${logDir}
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
# Make USB printers show up.
${modprobe}/sbin/modprobe usblp || true
'';
exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F";
};
services.printing.cupsdConf =
''
LogLevel debug
@ -58,7 +132,7 @@ let
ServerBin ${bindir}/lib/cups
AccessLog ${logDir}/access_log
ErrorLog ${logDir}/access_log
ErrorLog ${logDir}/error_log
PageLog ${logDir}/page_log
TempDir /tmp
@ -109,73 +183,6 @@ let
</Policy>
'';
in
{
###### interface
options = {
services.printing = {
enable = mkOption {
default = false;
description = ''
Whether to enable printing support through the CUPS daemon.
'';
};
bindirCmds = mkOption {
default = "";
description = ''
Additional commands executed while creating the directory
containing the CUPS server binaries.
'';
};
};
};
###### implementation
config = mkIf config.services.printing.enable {
environment.systemPackages = [cups];
services.dbus.packages = [cups];
environment.etc =
[ # CUPS expects the following files in its ServerRoot.
{ source = "${cups}/etc/cups/mime.convs";
target = "cups/mime.convs";
}
{ source = "${cups}/etc/cups/mime.types";
target = "cups/mime.types";
}
];
jobs.cupsd =
{ description = "CUPS printing daemon";
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
preStart =
''
mkdir -m 0755 -p ${logDir}
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
# Make USB printers show up.
${modprobe}/sbin/modprobe usblp || true
'';
exec = "${cups}/sbin/cupsd -c ${cupsdConfig} -F";
};
};
}