diff --git a/modules/services/imapnotify-accounts.nix b/modules/services/imapnotify-accounts.nix index e437f94e3..359a65b1f 100644 --- a/modules/services/imapnotify-accounts.nix +++ b/modules/services/imapnotify-accounts.nix @@ -30,10 +30,16 @@ with lib; description = "IMAP folders to watch."; }; + extraArgs = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "-wait 1" ]; + description = "Extra arguments to pass to goimapnotify."; + }; + extraConfig = mkOption { 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 a52b86e97..bf8fefd39 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -23,7 +23,10 @@ let Service = { # Use the nix store path for config to ensure service restarts when it changes ExecStart = - "${getExe cfg.package} -conf '${genAccountConfig account}'"; + "${getExe cfg.package} -conf '${genAccountConfig account}'" + " ${ + lib.optionalString (account.imapnotify.extraArgs != [ ]) + (toString account.imapnotify.extraArgs) + }"; Restart = "always"; RestartSec = 30; Type = "simple"; diff --git a/tests/modules/services/imapnotify/imapnotify.nix b/tests/modules/services/imapnotify/imapnotify.nix index 82d6f433b..680405fa5 100644 --- a/tests/modules/services/imapnotify/imapnotify.nix +++ b/tests/modules/services/imapnotify/imapnotify.nix @@ -11,6 +11,7 @@ imapnotify = { enable = true; boxes = [ "Inbox" ]; + extraArgs = [ "--wait 1" ]; onNotify = '' ${pkgs.notmuch}/bin/notmuch new ''; diff --git a/tests/modules/services/imapnotify/imapnotify.service b/tests/modules/services/imapnotify/imapnotify.service index cc1ba77b8..8168e501e 100644 --- a/tests/modules/services/imapnotify/imapnotify.service +++ b/tests/modules/services/imapnotify/imapnotify.service @@ -4,7 +4,7 @@ WantedBy=default.target [Service] Environment=PATH= Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config -ExecStart=@goimapnotify@/bin/goimapnotify -conf '/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json' +ExecStart=@goimapnotify@/bin/goimapnotify -conf '/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json' --wait 1 Restart=always RestartSec=30 Type=simple