···
7
+
concatMapLines = f: l: lib.concatStringsSep "\n" (map f l);
cfg = config.services.mlmmj;
stateDir = "/var/lib/mlmmj";
spoolDir = "/var/spool/mlmmj";
···
listAddress = domain: list: "${list}@${domain}";
customHeaders = domain: list: [ "List-Id: ${list}" "Reply-To: ${list}@${domain}" ];
footer = domain: list: "To unsubscribe send a mail to ${list}+unsubscribe@${domain}";
19
-
createList = d: l: ''
20
-
${pkgs.coreutils}/bin/mkdir -p ${listCtl d l}
21
-
echo ${listAddress d l} > ${listCtl d l}/listaddress
22
-
echo "${lib.concatStringsSep "\n" (customHeaders d l)}" > ${listCtl d l}/customheaders
23
-
echo ${footer d l} > ${listCtl d l}/footer
24
-
echo ${subjectPrefix l} > ${listCtl d l}/prefix
22
+
let ctlDir = listCtl d l; in
24
+
for DIR in incoming queue queue/discarded archive text subconf unsubconf \
25
+
bounce control moderation subscribers.d digesters.d requeue \
28
+
mkdir -p '${listDir d l}'/"$DIR"
30
+
${pkgs.coreutils}/bin/mkdir -p ${ctlDir}
31
+
echo ${listAddress d l} > '${ctlDir}/listaddress'
32
+
[ ! -e ${ctlDir}/customheaders ] && \
33
+
echo "${lib.concatStringsSep "\n" (customHeaders d l)}" > '${ctlDir}/customheaders'
34
+
[ ! -e ${ctlDir}/footer ] && \
35
+
echo ${footer d l} > '${ctlDir}/footer'
36
+
[ ! -e ${ctlDir}/prefix ] && \
37
+
echo ${subjectPrefix l} > '${ctlDir}/prefix'
···
description = "The collection of hosted maillists";
79
+
maintInterval = mkOption {
83
+
Time interval between mlmmj-maintd runs, see
84
+
<citerefentry><refentrytitle>systemd.time</refentrytitle>
85
+
<manvolnum>7</manvolnum></citerefentry> for format information.
···
mlmmj unix - n n - - pipe flags=ORhu user=mlmmj argv=${pkgs.mlmmj}/bin/mlmmj-receive -F -L ${spoolDir}/$nexthop
96
-
extraAliases = concatMapStrings (alias cfg.listDomain) cfg.mailLists;
119
+
extraAliases = concatMapLines (alias cfg.listDomain) cfg.mailLists;
transport_maps = hash:${stateDir}/transports
···
system.activationScripts.mlmmj = ''
${pkgs.coreutils}/bin/mkdir -p ${stateDir} ${spoolDir}/${cfg.listDomain}
${pkgs.coreutils}/bin/chown -R ${cfg.user}:${cfg.group} ${spoolDir}
110
-
${lib.concatMapStrings (createList cfg.listDomain) cfg.mailLists}
111
-
echo ${lib.concatMapStrings (virtual cfg.listDomain) cfg.mailLists} > ${stateDir}/virtuals
112
-
echo ${lib.concatMapStrings (transport cfg.listDomain) cfg.mailLists} > ${stateDir}/transports
133
+
${concatMapLines (createList cfg.listDomain) cfg.mailLists}
134
+
echo "${concatMapLines (virtual cfg.listDomain) cfg.mailLists}" > ${stateDir}/virtuals
135
+
echo "${concatMapLines (transport cfg.listDomain) cfg.mailLists}" > ${stateDir}/transports
${pkgs.postfix}/bin/postmap ${stateDir}/virtuals
${pkgs.postfix}/bin/postmap ${stateDir}/transports
systemd.services."mlmmj-maintd" = {
description = "mlmmj maintenance daemon";
119
-
wantedBy = [ "multi-user.target" ];
···
149
+
systemd.timers."mlmmj-maintd" = {
150
+
description = "mlmmj maintenance timer";
151
+
timerConfig.OnUnitActiveSec = cfg.maintInterval;
152
+
wantedBy = [ "timers.target" ];