Merge pull request #89486 from Ma27/dovecot-mailboxes
nixos/dovecot2: turn `mailboxes`-option into an attr-set
This commit is contained in:
commit
b20f9112d2
|
@ -614,6 +614,29 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ];
|
||||||
queued on the kernel side of the netlink socket.
|
queued on the kernel side of the netlink socket.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Specifying <link linkend="opt-services.dovecot2.mailboxes">mailboxes</link> in the <package>dovecot2</package> module
|
||||||
|
as a list is deprecated and will break eval in 21.03. Instead, an attribute-set should be specified where the <literal>name</literal>
|
||||||
|
should be the key of the attribute.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
This means that a configuration like this
|
||||||
|
<programlisting>{
|
||||||
|
<link linkend="opt-services.dovecot2.mailboxes">services.dovecot2.mailboxes</link> = [
|
||||||
|
{ name = "Junk";
|
||||||
|
auto = "create";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}</programlisting>
|
||||||
|
should now look like this:
|
||||||
|
<programlisting>{
|
||||||
|
<link linkend="opt-services.dovecot2.mailboxes">services.dovecot2.mailboxes</link> = {
|
||||||
|
Junk.auto = "create";
|
||||||
|
};
|
||||||
|
}</programlisting>
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -125,6 +125,8 @@ let
|
||||||
mailboxConfig = mailbox: ''
|
mailboxConfig = mailbox: ''
|
||||||
mailbox "${mailbox.name}" {
|
mailbox "${mailbox.name}" {
|
||||||
auto = ${toString mailbox.auto}
|
auto = ${toString mailbox.auto}
|
||||||
|
'' + optionalString (mailbox.autoexpunge != null) ''
|
||||||
|
autoexpunge = ${mailbox.autoexpunge}
|
||||||
'' + optionalString (mailbox.specialUse != null) ''
|
'' + optionalString (mailbox.specialUse != null) ''
|
||||||
special_use = \${toString mailbox.specialUse}
|
special_use = \${toString mailbox.specialUse}
|
||||||
'' + "}";
|
'' + "}";
|
||||||
|
@ -132,8 +134,9 @@ let
|
||||||
mailboxes = { ... }: {
|
mailboxes = { ... }: {
|
||||||
options = {
|
options = {
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.strMatching ''[^"]+'';
|
type = types.nullOr (types.strMatching ''[^"]+'');
|
||||||
example = "Spam";
|
example = "Spam";
|
||||||
|
default = null;
|
||||||
description = "The name of the mailbox.";
|
description = "The name of the mailbox.";
|
||||||
};
|
};
|
||||||
auto = mkOption {
|
auto = mkOption {
|
||||||
|
@ -148,6 +151,15 @@ let
|
||||||
example = "Junk";
|
example = "Junk";
|
||||||
description = "Null if no special use flag is set. Other than that every use flag mentioned in the RFC is valid.";
|
description = "Null if no special use flag is set. Other than that every use flag mentioned in the RFC is valid.";
|
||||||
};
|
};
|
||||||
|
autoexpunge = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "60d";
|
||||||
|
description = ''
|
||||||
|
To automatically remove all email from the mailbox which is older than the
|
||||||
|
specified time.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -323,9 +335,24 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
mailboxes = mkOption {
|
mailboxes = mkOption {
|
||||||
type = types.listOf (types.submodule mailboxes);
|
type = with types; let m = submodule mailboxes; in either (listOf m) (attrsOf m);
|
||||||
default = [];
|
default = {};
|
||||||
example = [ { name = "Spam"; specialUse = "Junk"; auto = "create"; } ];
|
apply = x:
|
||||||
|
if isList x then warn "Declaring `services.dovecot2.mailboxes' as a list is deprecated and will break eval in 21.03!" x
|
||||||
|
else mapAttrsToList (name: value:
|
||||||
|
if value.name != null
|
||||||
|
then throw ''
|
||||||
|
When specifying dovecot2 mailboxes as attributes, declaring
|
||||||
|
a `name'-attribute is prohibited! The name ${value.name} should
|
||||||
|
be the attribute key!
|
||||||
|
''
|
||||||
|
else value // { inherit name; }
|
||||||
|
) x;
|
||||||
|
example = literalExample ''
|
||||||
|
{
|
||||||
|
Spam = { specialUse = "Junk"; auto = "create"; };
|
||||||
|
}
|
||||||
|
'';
|
||||||
description = "Configure mailboxes and auto create or subscribe them.";
|
description = "Configure mailboxes and auto create or subscribe them.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue