summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2011-07-13 18:24:53 +0000
committerPeter Simons <simons@cryp.to>2011-07-13 18:24:53 +0000
commitd7c4900420361dd8b2213b3df407887982f05cf0 (patch)
tree9f364bc1586b989e7cbf9dfb5b5e8eb62b41191c
parentfb1b0c0372271f9ba8c732d0cbbcda9002998799 (diff)
downloadnixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar.gz
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar.bz2
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar.lz
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar.xz
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.tar.zst
nixpkgs-d7c4900420361dd8b2213b3df407887982f05cf0.zip
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.

svn path=/nixos/trunk/; revision=27769
-rw-r--r--modules/services/logging/syslogd.nix38
1 files changed, 27 insertions, 11 deletions
diff --git a/modules/services/logging/syslogd.nix b/modules/services/logging/syslogd.nix
index 64b158742ec..f6eb914b66e 100644
--- a/modules/services/logging/syslogd.nix
+++ b/modules/services/logging/syslogd.nix
@@ -4,9 +4,15 @@ with pkgs.lib;
 
 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 @@ let
     *.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 @@ in
       };
 
   };
-  
+
 }