···
+
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}";
+
let ctlDir = listCtl d l; in
+
for DIR in incoming queue queue/discarded archive text subconf unsubconf \
+
bounce control moderation subscribers.d digesters.d requeue \
+
mkdir -p '${listDir d l}'/"$DIR"
+
${pkgs.coreutils}/bin/mkdir -p ${ctlDir}
+
echo ${listAddress d l} > '${ctlDir}/listaddress'
+
[ ! -e ${ctlDir}/customheaders ] && \
+
echo "${lib.concatStringsSep "\n" (customHeaders d l)}" > '${ctlDir}/customheaders'
+
[ ! -e ${ctlDir}/footer ] && \
+
echo ${footer d l} > '${ctlDir}/footer'
+
[ ! -e ${ctlDir}/prefix ] && \
+
echo ${subjectPrefix l} > '${ctlDir}/prefix'
···
description = "The collection of hosted maillists";
+
maintInterval = mkOption {
+
Time interval between mlmmj-maintd runs, see
+
<citerefentry><refentrytitle>systemd.time</refentrytitle>
+
<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
+
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}
+
${concatMapLines (createList cfg.listDomain) cfg.mailLists}
+
echo "${concatMapLines (virtual cfg.listDomain) cfg.mailLists}" > ${stateDir}/virtuals
+
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";
···
+
systemd.timers."mlmmj-maintd" = {
+
description = "mlmmj maintenance timer";
+
timerConfig.OnUnitActiveSec = cfg.maintInterval;
+
wantedBy = [ "timers.target" ];