From 59c28cab1c2beb4938c185c6b994b976988e1081 Mon Sep 17 00:00:00 2001 From: Moritz 'e1mo' Fromm Date: Sun, 31 Jul 2022 13:45:25 +0200 Subject: nixos/parsedmarc: follow upstream configuration > Starting in version 8.0.0, most options from the `imap` section have been moved to the `mailbox` section. https://github.com/domainaware/parsedmarc/commit/6b2131f0e80e1ab8908540e3d2547b9503b784e5 --- nixos/modules/services/monitoring/parsedmarc.md | 1 - nixos/modules/services/monitoring/parsedmarc.nix | 46 +++++++++++++++--------- nixos/modules/services/monitoring/parsedmarc.xml | 7 ++-- nixos/tests/parsedmarc/default.nix | 1 - 4 files changed, 33 insertions(+), 22 deletions(-) (limited to 'nixos') 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: - + services.parsedmarc = { enable = true; settings.imap = { host = "imap.example.com"; user = "alice@example.com"; password = "/path/to/imap_password_file"; - 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 dmarc@monitoring.example.com. - + 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. - + 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; }; }; -- cgit 1.4.1