* Upstart job for the CUPS daemon.

svn path=/nixos/trunk/; revision=8534
This commit is contained in:
Eelco Dolstra 2007-04-02 17:31:58 +00:00
parent e312a8ef64
commit a9635d3b73
3 changed files with 109 additions and 0 deletions

View File

@ -752,6 +752,15 @@
}
{
name = ["services" "printing" "enable"];
default = false;
description = "
Whether to enable printing support through the CUPS daemon.
";
}
{
name = ["installer" "nixpkgsURL"];
default = "";

94
upstart-jobs/cupsd.nix Normal file
View File

@ -0,0 +1,94 @@
{ writeText, cups
}:
let
logDir = "/var/log/cups";
cupsdConfig = writeText "cupsd.conf" "
LogLevel info
SystemGroup root
Listen localhost:631
Listen /var/run/cups/cups.sock
ServerRoot ${cups}/etc/cups
AccessLog ${logDir}/access_log
ErrorLog ${logDir}/access_log
PageLog ${logDir}/page_log
TempDir /tmp
Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
DefaultAuthType Basic
<Location />
Order allow,deny
Allow localhost
</Location>
<Location /admin>
Order allow,deny
Allow localhost
</Location>
<Location /admin/conf>
AuthType Basic
Require user @SYSTEM
Order allow,deny
Allow localhost
</Location>
<Policy default>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
AuthType Basic
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
";
in
{
name = "cupsd";
extraPath = [
cups
];
job = "
description \"CUPS daemon\"
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
end script
respawn ${cups}/sbin/cupsd -c ${cupsdConfig} -F
";
}

View File

@ -146,6 +146,12 @@ import ../upstart-jobs/gather.nix {
inherit (pkgs) glibc pwdutils;
})
# CUPS (printing) daemon.
++ optional ["services" "printing" "enable"]
(import ../upstart-jobs/cupsd.nix {
inherit (pkgs) writeText cups;
})
# ALSA sound support.
++ optional ["sound" "enable"]
(import ../upstart-jobs/alsa.nix {