]> Git — Sourcephile - sourcephile-nix.git/blob - nixos/modules/services/mail/postfix.nix
dovecot: fix INDEX corruption by INDEXPVT
[sourcephile-nix.git] / nixos / modules / services / mail / postfix.nix
1 { pkgs, lib, config, ... }:
2 let inherit (lib) types;
3 inherit (pkgs.lib) unlinesAttrs unwords;
4 inherit (config) networking;
5 inherit (config.services) postfix;
6 in
7 {
8 options.services.postfix = {
9 aliases = lib.mkOption {
10 type = with types; attrsOf (listOf str);
11 default = {};
12 example = { "root@${networking.domain}" = [
13 "user1@${networking.domain}"
14 "user2@${networking.domain}"
15 ];
16 "@example.coop" = ["user1@${networking.domain}"];
17 };
18 };
19 };
20 config = lib.mkIf postfix.enable {
21 services.postfix = {
22 mapFiles."virtual_alias_maps" = pkgs.writeText "virtual_alias_maps"
23 (unlinesAttrs
24 (from: to: "${from} ${unwords to}")
25 postfix.aliases);
26 config = {
27 virtual_alias_maps = [
28 "hash:/etc/postfix/virtual_alias_maps"
29 ];
30 };
31 };
32 };
33 }