diff options
author | aszlig <aszlig@redmoonstudios.org> | 2015-03-18 01:12:15 +0100 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2015-03-18 01:12:15 +0100 |
commit | 692b0772223074133c5fe74d84ea727fb00499e3 (patch) | |
tree | d3d20d087665377ef0f7622e66bd6557fbaebcc9 /labernix/modules/services/postfix/restrictions.nix | |
parent | 0182c32769f18926489847bb21636e7b394b5b30 (diff) | |
parent | 6b857eebbafba660cc57b19bd11f6484c91f8fd7 (diff) |
Subtree-merge labernix into vuizvui.
This is the first step of generalizing the configurations into a big repository where people can track their NixOS configurations and write modules. In the next few steps I'm going to gradually refactor everything in labernix/ into the main tree and factor out personal stuff into separate namespaces. Also, this will involve a license change from APACHE-2.0 to GPL-3.0.
Diffstat (limited to 'labernix/modules/services/postfix/restrictions.nix')
-rw-r--r-- | labernix/modules/services/postfix/restrictions.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/labernix/modules/services/postfix/restrictions.nix b/labernix/modules/services/postfix/restrictions.nix new file mode 100644 index 00000000..fbb47f10 --- /dev/null +++ b/labernix/modules/services/postfix/restrictions.nix @@ -0,0 +1,53 @@ +{ config, lib, ... }: + +with lib; + +let + mkRestriction = name: specificDescription: { + option.${name} = mkOption { + default = null; + type = types.nullOr types.list; + description = '' + A list of restrictions to apply or <option>null</option> to use the + built-in default value from Postfix. + ${specificDescription} + ''; + }; + config = let + cfg = config.labernix.postfix.restrictions.${name}; + in mkIf (cfg != null) '' + smtpd_${name}_restrictions = ${concatStringsSep ", " cfg} + ''; + }; + restrictions = mapAttrsToList mkRestriction { + client = mkRestriction '' + SMTP server access restrictions in the context of a client SMTP connection + request. + ''; + data = mkRestriction '' + Access restrictions that the Postfix SMTP server applies in the context of + the SMTP DATA command. + ''; + end_of_data = mkRestriction '' + Access restrictions that the Postfix SMTP server applies in the context of + the SMTP END-OF-DATA command. + ''; + etrn = mkRestriction '' + SMTP server access restrictions in the context of a client ETRN request. + ''; + helo = mkRestriction '' + Restrictions that the Postfix SMTP server applies in the context of the + SMTP HELO command. + ''; + recipient = mkRestriction '' + Access restrictions that the Postfix SMTP server applies in the context of + the RCPT TO command. + ''; + sender = mkRestriction '' + Restrictions that the Postfix SMTP server applies in the context of the + MAIL FROM command. + ''; + }; +in { + options.labernix.postfix.restrictions = mapAttrs mkRestriction restrictions; +} |