diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index 63e61e7c7..2bc6ee6ab 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -27,9 +27,11 @@ let Restart = "always"; RestartSec = 30; Type = "simple"; - } // optionalAttrs account.notmuch.enable { - Environment = - "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; + Environment = [ + (lib.mkIf account.notmuch.enable + "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config") + "PATH=${cfg.path}" + ]; }; Install = { WantedBy = [ "default.target" ]; }; @@ -97,6 +99,14 @@ in { example = literalExpression "pkgs.imapnotify"; description = "The imapnotify package to use"; }; + + path = mkOption { + description = + "List of packages to provide in PATH for the imapnotify service"; + type = types.listOf types.package; + apply = lib.makeBinPath; + default = [ ]; + }; }; accounts.email.accounts = mkOption { @@ -122,6 +132,12 @@ in { (checkAccounts (a: a.userName == null) "username") ]; + services.imapnotify.path = lib.mkMerge [ + (lib.mkIf config.programs.notmuch.enable [ pkgs.notmuch ]) + (lib.mkIf config.programs.mbsync.enable + [ config.programs.mbsync.package ]) + ]; + systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts); launchd.agents = listToAttrs (map genAccountAgent imapnotifyAccounts);