Convert "printing", CUPS daemon

svn path=/nixos/branches/fix-style/; revision=14384
This commit is contained in:
Marc Weber 2009-03-06 12:26:46 +00:00
parent 4d0761beb2
commit d0733953e1
3 changed files with 61 additions and 46 deletions

View File

@ -479,18 +479,6 @@ in
};
printing = {
enable = mkOption {
default = false;
description = "
Whether to enable printing support through the CUPS daemon.
";
};
};
udev = {
addFirmware = mkOption {
@ -1026,6 +1014,7 @@ in
(import ../upstart-jobs/httpd.nix) # Apache httpd (probably this can be removed ?)
(import ../upstart-jobs/apache-httpd) # Apache httpd (new style).
(import ../upstart-jobs/vsftpd.nix)
(import ../upstart-jobs/cupsd.nix) # CUPS printing daemon
# nix
(import ../upstart-jobs/nix.nix) # nix options and daemon

View File

@ -1,4 +1,26 @@
{config, pkgs, modprobe}:
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
services = {
printing = {
enable = mkOption {
default = false;
description = "
Whether to enable printing support through the CUPS daemon.
";
};
};
};
};
in
###### implementation
let
@ -7,6 +29,8 @@ let
inherit (pkgs) cups;
modprobe = config.system.sbin.modprobe;
# Here we can enable additional backends, filters, etc. that are not
# part of CUPS itself, e.g. the SMB backend is part of Samba. Since
@ -101,37 +125,45 @@ let
in
{
name = "cupsd";
extraPath = [cups];
extraEtc = [
# 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";
}
mkIf config.services.pulseaudio.enable {
require = [
options
];
job = ''
description "CUPS printing daemon"
start on network-interfaces/started
stop on network-interfaces/stop
services = {
extraJobs = [{
name = "cupsd";
start script
mkdir -m 0755 -p ${logDir}
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
extraPath = [cups];
# Make USB printers show up.
${modprobe}/sbin/modprobe usblp || true
end script
extraEtc = [
# 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";
}
];
job = ''
description "CUPS printing daemon"
respawn ${cups}/sbin/cupsd -c ${cupsdConfig} -F
'';
start on network-interfaces/started
stop on network-interfaces/stop
start script
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
end script
respawn ${cups}/sbin/cupsd -c ${cupsdConfig} -F
'';
}];
};
}

View File

@ -166,12 +166,6 @@ let
inherit (pkgs) glibc samba;
})
# CUPS (printing) daemon.
++ optional config.services.printing.enable
(import ../upstart-jobs/cupsd.nix {
inherit config pkgs modprobe;
})
# X Font Server
++ optional config.services.xfs.enable
(import ../upstart-jobs/xfs.nix {