From 425ec4cb00d09a0803d9cc8cdbc554661c704a8a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Jul 2012 12:48:30 -0400 Subject: [PATCH] syslogd: Make it work with systemd Also made syslogd optional (and disabled by default). --- modules/services/logging/syslogd.nix | 32 ++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/services/logging/syslogd.nix b/modules/services/logging/syslogd.nix index bfe7352122c0..2136aaa5586c 100644 --- a/modules/services/logging/syslogd.nix +++ b/modules/services/logging/syslogd.nix @@ -36,6 +36,15 @@ in services.syslogd = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable syslogd. Note that systemd also logs + syslog messages, so you normally don't need to run syslogd. + ''; + }; + tty = mkOption { type = types.uniq types.string; default = "tty10"; @@ -89,22 +98,27 @@ in ###### implementation - config = { + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.sysklogd ]; services.syslogd.extraParams = optional cfg.enableNetworkInput "-r"; - jobs.syslogd = + boot.systemd.services."syslog.service" = { description = "Syslog daemon"; + + requires = [ "syslog.socket" ]; - #startOn = "started udev"; + wantedBy = [ "multi-user.target" "syslog.target" ]; - environment = { TZ = config.time.timeZone; }; + environment.TZ = config.time.timeZone; - daemonType = "fork"; - - path = [ pkgs.sysklogd ]; - - exec = "syslogd ${toString cfg.extraParams} -f ${syslogConf}"; + serviceConfig = + '' + ExecStart=${pkgs.sysklogd}/sbin/syslogd ${toString cfg.extraParams} -f ${syslogConf} -n + # Prevent syslogd output looping back through journald. + StandardOutput=null + ''; }; };