about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorKim Lindberger <kim.lindberger@gmail.com>2023-01-03 12:26:06 +0100
committerGitHub <noreply@github.com>2023-01-03 12:26:06 +0100
commitba1e6e5f8c12193e1ebbe9aa84e993b8f2de3bd3 (patch)
tree447d64f21571bdcd297415797668211d7c0eb4cb /nixos
parente2e34b131856252249b7729a86fc2cb9b77196a9 (diff)
parent59c28cab1c2beb4938c185c6b994b976988e1081 (diff)
Merge pull request #184206 from e1mo/e1mo/parsedmarc-new-config
nixos/parsedmarc: follow upstream configuration
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/parsedmarc.md1
-rw-r--r--nixos/modules/services/monitoring/parsedmarc.nix46
-rw-r--r--nixos/modules/services/monitoring/parsedmarc.xml7
-rw-r--r--nixos/tests/parsedmarc/default.nix1
4 files changed, 33 insertions, 22 deletions
diff --git a/nixos/modules/services/monitoring/parsedmarc.md b/nixos/modules/services/monitoring/parsedmarc.md
index d93134a4cc767..5a17f79da5d46 100644
--- a/nixos/modules/services/monitoring/parsedmarc.md
+++ b/nixos/modules/services/monitoring/parsedmarc.md
@@ -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!
 };
diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix
index 3540d91fc9f37..40c76b804559c 100644
--- a/nixos/modules/services/monitoring/parsedmarc.nix
+++ b/nixos/modules/services/monitoring/parsedmarc.nix
@@ -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;
         };
       })
diff --git a/nixos/modules/services/monitoring/parsedmarc.xml b/nixos/modules/services/monitoring/parsedmarc.xml
index 7167b52d0357d..b6a4bcf8ff5a5 100644
--- a/nixos/modules/services/monitoring/parsedmarc.xml
+++ b/nixos/modules/services/monitoring/parsedmarc.xml
@@ -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 domain’s 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 = {
diff --git a/nixos/tests/parsedmarc/default.nix b/nixos/tests/parsedmarc/default.nix
index 50b977723e9c7..837cf9d7e6dce 100644
--- a/nixos/tests/parsedmarc/default.nix
+++ b/nixos/tests/parsedmarc/default.nix
@@ -155,7 +155,6 @@ in
                   ssl = true;
                   user = "alice";
                   password = "${pkgs.writeText "imap-password" "foobar"}";
-                  watch = true;
                 };
               };