exim-retiolum: add system-aliases option

This commit is contained in:
lassulus 2020-12-04 19:20:35 +01:00
parent 70bfe7e697
commit 6e09a80450

View File

@ -10,6 +10,11 @@ with import <stockholm/lib>;
(s: substring 1 (stringLength s - 2) s) (s: substring 1 (stringLength s - 2) s)
(toJSON value); (toJSON value);
to-lsearch = concatMapStrings ({ from, to, ... }: "${from}: ${to}\n");
lsearch = mapAttrs (name: set: toFile name (to-lsearch set)) ({
inherit (cfg) system-aliases;
});
in { in {
options.krebs.exim-retiolum = { options.krebs.exim-retiolum = {
enable = mkEnableOption "krebs.exim-retiolum"; enable = mkEnableOption "krebs.exim-retiolum";
@ -59,6 +64,19 @@ in {
}; };
}; };
}; };
system-aliases = mkOption {
type = types.listOf (types.submodule ({
options = {
from = mkOption {
type = types.str; # TODO e-mail address
};
to = mkOption {
type = types.str; # TODO e-mail address / TODO listOf
};
};
}));
default = [];
};
}; };
imports = [ imports = [
{ {
@ -145,6 +163,11 @@ in {
begin routers begin routers
system_aliases:
debug_print = "R: system_aliases for $local_part@$domain"
driver = redirect
data = ''${lookup{$local_part}lsearch{${lsearch.system-aliases}}}
local: local:
driver = accept driver = accept
domains = +local_domains domains = +local_domains