1 { pkgs, lib, config, ... }:
2 let inherit (lib) types;
3 inherit (pkgs.lib) unlinesAttrs unwords;
4 inherit (config) networking;
5 inherit (config.services) postfix;
8 options.services.postfix = {
9 aliases = lib.mkOption {
10 type = with types; attrsOf (listOf str);
12 example = { "root@${networking.domain}" = [
13 "user1@${networking.domain}"
14 "user2@${networking.domain}"
16 "@example.coop" = ["user1@${networking.domain}"];
20 config = lib.mkIf postfix.enable {
22 mapFiles."virtual_alias_maps" = pkgs.writeText "virtual_alias_maps"
24 (from: to: "${from} ${unwords to}")
27 virtual_alias_maps = [
28 "hash:/etc/postfix/virtual_alias_maps"