Author: simons
Date: Wed Jul 13 18:24:53 2011
New Revision: 27769
URL: https://svn.nixos.org/websvn/nix/?rev=27769&sc=1
Log:
syslogd: extended configuration options
This commit adds the option 'services.syslogd.defaultConfig', which is
the main syslog.conf file used by the daemon. Like before, That file can
be extended by means of 'services.syslogd.extraConfig'. Users who want a
completely different configuration, however, can re-define defaultConfig
to their liking.
Furthermore, the option services.syslogd.tty' is now optional: setting
its value to the empty string "" disables logging to TTY altogether.
Modified:
nixos/trunk/modules/services/logging/syslogd.nix
Modified: nixos/trunk/modules/services/logging/syslogd.nix
==============================================================================
--- nixos/trunk/modules/services/logging/syslogd.nix Wed Jul 13 18:15:57
2011 (r27768)
+++ nixos/trunk/modules/services/logging/syslogd.nix Wed Jul 13 18:24:53
2011 (r27769)
@@ -4,9 +4,15 @@
let
+ cfg = config.services.syslogd;
+
syslogConf = pkgs.writeText "syslog.conf" ''
- kern.warning;*.err;authpriv.none /dev/${config.services.syslogd.tty}
+ ${if (cfg.tty != "") then "kern.warning;*.err;authpriv.none
/dev/${cfg.tty}" else ""}
+ ${cfg.defaultConfig}
+ ${cfg.extraConfig}
+ '';
+ defaultConf = ''
# Send emergency messages to all users.
*.emerg *
@@ -19,44 +25,54 @@
*.crit /var/log/warn
*.*;mail.none;local1.none -/var/log/messages
-
- ${config.services.syslogd.extraConfig}
'';
-
in
{
###### interface
options = {
-
+
services.syslogd = {
tty = mkOption {
+ type = types.string;
default = "tty10";
description = ''
The tty device on which syslogd will print important log
- messages.
+ messages. Leave this option blank to disable tty logging.
+ '';
+ };
+
+ defaultConfig = mkOption {
+ type = types.string;
+ default = defaultConf;
+ description = ''
+ The default <filename>syslog.conf</filename> file configures a
+ fairly standard setup of log files, which can be extended by
+ means of <varname>extraConfig</varname>.
'';
};
extraConfig = mkOption {
+ type = types.string;
default = "";
example = "news.* -/var/log/news";
description = ''
- Additional text appended to <filename>syslog.conf</filename>.
+ Additional text appended to <filename>syslog.conf</filename>,
+ i.e. the contents of <varname>defaultConfig</varname>.
'';
};
-
+
};
-
+
};
###### implementation
config = {
-
+
jobs.syslogd =
{ description = "Syslog daemon";
@@ -70,5 +86,5 @@
};
};
-
+
}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits