From 05262ad35d9fb7db15ca097f8c931f6c5b3999fe Mon Sep 17 00:00:00 2001 From: Mathijs Kwik Date: Fri, 24 Aug 2012 00:27:07 +0200 Subject: [PATCH] postfix: allow specifying 'virtual' mappings mainly useful for having a few local addresses (me@host.domain.com) while the majority of addresses are on the domain (you@domain.com) --- modules/services/mail/postfix.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 842427f6d059..3784ae3d39f6 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -80,6 +80,9 @@ let recipientDelimiter = ${cfg.recipientDelimiter} '' + + optionalString (cfg.virtual != "") '' + virtual_alias_maps = hash:/etc/postfix/virtual + '' + cfg.extraConfig; aliases = @@ -93,6 +96,7 @@ let ; aliasesFile = pkgs.writeText "postfix-aliases" aliases; + virtualFile = pkgs.writeText "postfix-virtual" cfg.virtual; mainCfFile = pkgs.writeText "postfix-main.cf" mainCf; in @@ -255,6 +259,13 @@ in "; }; + virtual = mkOption { + default = ""; + description = " + Entries for the virtual alias map. + "; + }; + }; }; @@ -338,9 +349,11 @@ in ln -sf ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf ln -sf ${aliasesFile} /var/postfix/conf/aliases + ln -sf ${virtualFile} /var/postfix/conf/virtual ln -sf ${mainCfFile} /var/postfix/conf/main.cf ${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases + ${pkgs.postfix}/sbin/postmap -c /var/postfix/conf /var/postfix/conf/virtual exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start ''; # */