diff options
author | Robin Raymond <robin@robinraymond.de> | 2017-08-31 10:49:01 +0200 |
---|---|---|
committer | Robin Raymond <robin@robinraymond.de> | 2017-08-31 10:49:01 +0200 |
commit | b0ae2de5f4e0e5f98071f7df5b71de875bb582cf (patch) | |
tree | 61bc80e8ed50a34fe0373dcf5d06d002845d9c45 /mail-server/postfix.nix | |
parent | 42c4e18438efd52bc6749fd8b7f7e4495b8ec5ef (diff) | |
parent | 692a677194b00cbdcb11a59b732e2decbe237c8c (diff) |
Merge branch 'master' of https://github.com/Infinisil/nixos-mailserver into module-rewrite
Diffstat (limited to 'mail-server/postfix.nix')
-rw-r--r-- | mail-server/postfix.nix | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/mail-server/postfix.nix b/mail-server/postfix.nix index d9ff629..fb4dbc1 100644 --- a/mail-server/postfix.nix +++ b/mail-server/postfix.nix @@ -14,22 +14,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> -{ mail_dir, domain, valiases, cert, key }: +{ lib, mail_dir, domain, valiases, cert, key }: let - # valiasToString :: { from = "..."; to = "..." } -> String - valiasToString = x: "${x.from}@${domain} ${x.to}@${domain}\n"; - # valiases_postfix :: [ String ] - valiases_postfix = map valiasToString valiases; - - # concatString :: [ String ] -> String - concatString = l: if l == [] - then "" - else (builtins.head l) + (concatString (builtins.tail l)); + valiases_postfix = map + (from: + let to = valiases.${from}; + in "${from}@${domain} ${to}@${domain}") + (builtins.attrNames valiases); # valiases_file :: Path - valiases_file = builtins.toFile "valias" (concatString valiases_postfix); + valiases_file = builtins.toFile "valias" (lib.concatStringsSep "\n" valiases_postfix); # vhosts_file :: Path vhosts_file = builtins.toFile "vhosts" domain; |