2009-03-06 12:25:57 +00:00
|
|
|
{pkgs, config, ...}:
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2009-03-06 12:25:57 +00:00
|
|
|
###### interface
|
2008-04-01 13:50:47 +01:00
|
|
|
let
|
2009-03-06 12:25:57 +00:00
|
|
|
inherit (pkgs.lib) mkOption mkIf;
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2009-03-06 12:25:57 +00:00
|
|
|
options = {
|
|
|
|
services = {
|
|
|
|
|
|
|
|
syslogd = {
|
|
|
|
|
|
|
|
tty = mkOption {
|
|
|
|
default = 10;
|
|
|
|
description = "
|
|
|
|
The tty device on which syslogd will print important log
|
|
|
|
messages.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
syslogConf = pkgs.writeText "syslog.conf" ''
|
2008-05-08 14:47:44 +01:00
|
|
|
kern.warning;*.err;authpriv.none /dev/tty10
|
|
|
|
|
|
|
|
# Send emergency messages to all users.
|
|
|
|
*.emerg *
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
# "local1" is used for dhcpd messages.
|
|
|
|
local1.* -/var/log/dhcpd
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
mail.* -/var/log/mail
|
2008-04-01 13:50:47 +01:00
|
|
|
|
2008-05-08 13:27:01 +01:00
|
|
|
*.=warning;*.=err -/var/log/warn
|
|
|
|
*.crit /var/log/warn
|
|
|
|
|
|
|
|
*.*;mail.none;local1.none -/var/log/messages
|
2008-04-01 13:50:47 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
2006-11-19 20:07:45 +00:00
|
|
|
|
2006-11-19 21:03:22 +00:00
|
|
|
{
|
2009-03-06 12:25:57 +00:00
|
|
|
require = [
|
|
|
|
options
|
|
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
|
|
extraJobs = [{
|
|
|
|
name = "syslogd";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
description "Syslog daemon"
|
|
|
|
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
|
|
|
|
|
|
|
env TZ=${config.time.timeZone}
|
|
|
|
|
|
|
|
respawn ${pkgs.sysklogd}/sbin/syslogd -n -f ${syslogConf}
|
|
|
|
'';
|
|
|
|
}];
|
|
|
|
};
|
2006-11-19 20:07:45 +00:00
|
|
|
}
|