From 1b249eaf0568e9d14915d76690afb43442612cc2 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 3 Aug 2012 15:11:28 +0200 Subject: [PATCH] Initial version of a SpamAssassin service. The configuration is expected to be managed by the user in /etc/spamassassin. --- modules/module-list.nix | 1 + modules/services/mail/spamassassin.nix | 45 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 modules/services/mail/spamassassin.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index e2c9516ac46..bc3948182c3 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -88,6 +88,7 @@ ./services/mail/freepops.nix ./services/mail/mail.nix ./services/mail/postfix.nix + ./services/mail/spamassassin.nix ./services/misc/autofs.nix ./services/misc/disnix.nix ./services/misc/felix.nix diff --git a/modules/services/mail/spamassassin.nix b/modules/services/mail/spamassassin.nix new file mode 100644 index 00000000000..e91c709cba2 --- /dev/null +++ b/modules/services/mail/spamassassin.nix @@ -0,0 +1,45 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.spamassassin; + +in + +{ + + ###### interface + + options = { + + services.spamassassin = { + + enable = mkOption { + default = false; + description = "Whether to run the SpamAssassin daemon."; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + # This makes comfortable for users to run 'spamassassin'. + environment.systemPackages = [ pkgs.spamassassin ]; + + jobs.spamd = { + description = "Spam Assassin Server"; + startOn = "started networking and filesystem"; + environment.TZ = config.time.timeZone; + exec = "spamd -C /etc/spamassassin/init.pre --siteconfigpath=/etc/spamassassin --debug --pidfile=/var/run/spamd.pid"; + }; + + }; + +}