1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

imapnotify: provide an option for setting PATH

Including some useful presetting for notmuch and mbsync.
This commit is contained in:
Linus Heckemann 2024-08-16 11:34:29 +02:00
parent a46e702093
commit 396f3af0d9

View file

@ -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);