1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00: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 committed by Robert Helgesson
parent 0daaded612
commit 65912bc684
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 20 additions and 2 deletions

View file

@ -27,8 +27,8 @@ let
Restart = "always"; Restart = "always";
RestartSec = 30; RestartSec = 30;
Type = "simple"; Type = "simple";
} // optionalAttrs account.notmuch.enable { Environment = [ "PATH=${cfg.path}" ]
Environment = ++ optional account.notmuch.enable
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config"; "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config";
}; };
@ -97,6 +97,17 @@ in {
example = literalExpression "pkgs.imapnotify"; example = literalExpression "pkgs.imapnotify";
description = "The imapnotify package to use"; description = "The imapnotify package to use";
}; };
path = mkOption {
type = types.listOf types.package;
apply = lib.makeBinPath;
default = [ ];
description = ''
List of packages to provide in PATH for the imapnotify service.
Note, this does not apply to the Darwin launchd service.
'';
};
}; };
accounts.email.accounts = mkOption { accounts.email.accounts = mkOption {
@ -122,6 +133,12 @@ in {
(checkAccounts (a: a.userName == null) "username") (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); systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts);
launchd.agents = listToAttrs (map genAccountAgent imapnotifyAccounts); launchd.agents = listToAttrs (map genAccountAgent imapnotifyAccounts);

View file

@ -2,6 +2,7 @@
WantedBy=default.target WantedBy=default.target
[Service] [Service]
Environment=PATH=
Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config 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'
Restart=always Restart=always