From f5b03feb33629cb2b6dd513935637e8cc718a5ba Mon Sep 17 00:00:00 2001 From: Genevieve <4873173+dryya@users.noreply.github.com> Date: Sat, 15 Jul 2023 18:53:43 +0000 Subject: [PATCH] imapnotify: Use JSON type for extraConfig (#4238) Prior to this change, it was impossible to nest attrsets in accounts.email.accounts..imapnotify.extraConfig. However, goimapnotify's configuration is JSON-based, and the recommended configuration has: ``` "tlsOptions": { "rejectUnauthorized": true }, ``` This change changes the type from an attrset of str/int/bool to the JSON type provided by nixpkg's `pkgs.formats.json`. --- modules/services/imapnotify-accounts.nix | 4 ++-- modules/services/imapnotify.nix | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/services/imapnotify-accounts.nix b/modules/services/imapnotify-accounts.nix index 5d8418310..e437f94e3 100644 --- a/modules/services/imapnotify-accounts.nix +++ b/modules/services/imapnotify-accounts.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ pkgs, lib, ... }: with lib; @@ -31,7 +31,7 @@ with lib; }; extraConfig = mkOption { - type = with types; attrsOf (oneOf [ bool int str ]); + type = let jsonFormat = pkgs.formats.json { }; in jsonFormat.type; default = { }; example = { wait = 10; }; description = "Additional configuration to add for this account."; diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index bc595ca95..a79cba35e 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -99,7 +99,9 @@ in { }; accounts.email.accounts = mkOption { - type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix)); + type = with types; + attrsOf + (submodule (import ./imapnotify-accounts.nix { inherit pkgs lib; })); }; };