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)
This commit is contained in:
parent
16713db4e2
commit
05262ad35d
@ -80,6 +80,9 @@ let
|
|||||||
|
|
||||||
recipientDelimiter = ${cfg.recipientDelimiter}
|
recipientDelimiter = ${cfg.recipientDelimiter}
|
||||||
''
|
''
|
||||||
|
+ optionalString (cfg.virtual != "") ''
|
||||||
|
virtual_alias_maps = hash:/etc/postfix/virtual
|
||||||
|
''
|
||||||
+ cfg.extraConfig;
|
+ cfg.extraConfig;
|
||||||
|
|
||||||
aliases =
|
aliases =
|
||||||
@ -93,6 +96,7 @@ let
|
|||||||
;
|
;
|
||||||
|
|
||||||
aliasesFile = pkgs.writeText "postfix-aliases" aliases;
|
aliasesFile = pkgs.writeText "postfix-aliases" aliases;
|
||||||
|
virtualFile = pkgs.writeText "postfix-virtual" cfg.virtual;
|
||||||
mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
|
mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
|
||||||
|
|
||||||
in
|
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 ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf
|
||||||
|
|
||||||
ln -sf ${aliasesFile} /var/postfix/conf/aliases
|
ln -sf ${aliasesFile} /var/postfix/conf/aliases
|
||||||
|
ln -sf ${virtualFile} /var/postfix/conf/virtual
|
||||||
ln -sf ${mainCfFile} /var/postfix/conf/main.cf
|
ln -sf ${mainCfFile} /var/postfix/conf/main.cf
|
||||||
|
|
||||||
${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases
|
${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
|
exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
|
||||||
''; # */
|
''; # */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user