Skip to content

Commit

Permalink
imapnotify: provide an option for setting PATH
Browse files Browse the repository at this point in the history
Including some useful presetting for notmuch and mbsync.
  • Loading branch information
lheckemann authored and rycee committed Dec 5, 2024
1 parent 0daaded commit 65912bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions modules/services/imapnotify.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let
Restart = "always";
RestartSec = 30;
Type = "simple";
} // optionalAttrs account.notmuch.enable {
Environment =
Environment = [ "PATH=${cfg.path}" ]
++ optional account.notmuch.enable
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config";
};

Expand Down Expand Up @@ -97,6 +97,17 @@ in {
example = literalExpression "pkgs.imapnotify";
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 {
Expand All @@ -122,6 +133,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);
Expand Down
1 change: 1 addition & 0 deletions tests/modules/services/imapnotify/imapnotify.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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'
Restart=always
Expand Down

0 comments on commit 65912bc

Please sign in to comment.