From 6168b2d98f6a510ebce7bb3fd41751d5a8f69601 Mon Sep 17 00:00:00 2001 From: Coutinho de Souza Date: Wed, 29 Jan 2025 10:29:02 -0300 Subject: [PATCH] imapnotify: add `wait` option to imapnotify-accounts `wait` is no longer a part of the goimapnotify's config, but one of its cli options. --- modules/services/imapnotify-accounts.nix | 9 ++++++++- modules/services/imapnotify.nix | 4 +++- tests/modules/services/imapnotify/imapnotify.service | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/services/imapnotify-accounts.nix b/modules/services/imapnotify-accounts.nix index e437f94e3..77373591b 100644 --- a/modules/services/imapnotify-accounts.nix +++ b/modules/services/imapnotify-accounts.nix @@ -30,10 +30,17 @@ with lib; description = "IMAP folders to watch."; }; + wait = mkOption { + type = types.int; + default = 1; + example = 10; + description = + "Wait time in seconds between IDLE event and execution of scripts"; + }; + 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..e201a1c5a 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -23,7 +23,9 @@ 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}' -wait ${ + toString account.imapnotify.wait + }"; Restart = "always"; RestartSec = 30; Type = "simple"; diff --git a/tests/modules/services/imapnotify/imapnotify.service b/tests/modules/services/imapnotify/imapnotify.service index cc1ba77b8..344551483 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