nixos/parsedmarc: follow upstream configuration

> Starting in version 8.0.0, most options from the `imap` section have
been moved to the `mailbox` section.

6b2131f0e8
This commit is contained in:
Moritz 'e1mo' Fromm 2022-07-31 13:45:25 +02:00
parent 44cee687b5
commit 59c28cab1c
No known key found for this signature in database
GPG Key ID: 1D5D79A439E787F1
4 changed files with 33 additions and 22 deletions

View File

@ -17,7 +17,6 @@ services.parsedmarc = {
host = "imap.example.com";
user = "alice@example.com";
password = "/path/to/imap_password_file";
watch = true;
};
provision.geoIp = false; # Not recommended!
};

View File

@ -123,7 +123,10 @@ in
host = "imap.example.com";
user = "alice@example.com";
password = { _secret = "/run/keys/imap_password" };
};
mailbox = {
watch = true;
batch_size = 30;
};
splunk_hec = {
url = "https://splunkhec.example.com";
@ -170,6 +173,24 @@ in
};
};
mailbox = {
watch = lib.mkOption {
type = lib.types.bool;
default = true;
description = lib.mdDoc ''
Use the IMAP IDLE command to process messages as they arrive.
'';
};
delete = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc ''
Delete messages after processing them, instead of archiving them.
'';
};
};
imap = {
host = lib.mkOption {
type = lib.types.str;
@ -216,22 +237,6 @@ in
'';
apply = x: if isAttrs x || x == null then x else { _secret = x; };
};
watch = lib.mkOption {
type = lib.types.bool;
default = true;
description = lib.mdDoc ''
Use the IMAP IDLE command to process messages as they arrive.
'';
};
delete = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc ''
Delete messages after processing them, instead of archiving them.
'';
};
};
smtp = {
@ -360,6 +365,13 @@ in
config = lib.mkIf cfg.enable {
warnings = let
deprecationWarning = optname: "Starting in 8.0.0, the `${optname}` option has been moved from the `services.parsedmarc.settings.imap`"
+ "configuration section to the `services.parsedmarc.settings.mailbox` configuration section.";
hasImapOpt = lib.flip builtins.hasAttr cfg.settings.imap;
movedOptions = [ "reports_folder" "archive_folder" "watch" "delete" "test" "batch_size" ];
in builtins.map deprecationWarning (builtins.filter hasImapOpt movedOptions);
services.elasticsearch.enable = lib.mkDefault cfg.provision.elasticsearch;
services.geoipupdate = lib.mkIf cfg.provision.geoIp {
@ -444,6 +456,8 @@ in
ssl = false;
user = cfg.provision.localMail.recipientName;
password = "${pkgs.writeText "imap-password" "@imap-password@"}";
};
mailbox = {
watch = true;
};
})

View File

@ -15,14 +15,13 @@
email address and saves them to a local Elasticsearch instance
looks like this:
</para>
<programlisting language="bash">
<programlisting>
services.parsedmarc = {
enable = true;
settings.imap = {
host = &quot;imap.example.com&quot;;
user = &quot;alice@example.com&quot;;
password = &quot;/path/to/imap_password_file&quot;;
watch = true;
};
provision.geoIp = false; # Not recommended!
};
@ -45,7 +44,7 @@ services.parsedmarc = {
email address that should be configured in the domains dmarc
policy is <literal>dmarc@monitoring.example.com</literal>.
</para>
<programlisting language="bash">
<programlisting>
services.parsedmarc = {
enable = true;
provision = {
@ -68,7 +67,7 @@ services.parsedmarc = {
Elasticsearch instance is automatically added as a Grafana
datasource, and the dashboard is added to Grafana as well.
</para>
<programlisting language="bash">
<programlisting>
services.parsedmarc = {
enable = true;
provision = {

View File

@ -155,7 +155,6 @@ in
ssl = true;
user = "alice";
password = "${pkgs.writeText "imap-password" "foobar"}";
watch = true;
};
};