2019-02-05 06:03:04 +00:00
|
|
|
pkgs:
|
2018-08-06 10:05:46 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
options.alot = {
|
|
|
|
sendMailCommand = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2018-08-06 10:05:46 +00:00
|
|
|
Command to send a mail. If msmtp is enabled for the account,
|
|
|
|
then this is set to
|
2023-06-30 23:30:13 +00:00
|
|
|
{command}`msmtpq --read-envelope-from --read-recipients`.
|
2018-08-06 10:05:46 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2019-02-05 06:03:04 +00:00
|
|
|
contactCompletion = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = {
|
|
|
|
type = "shellcommand";
|
2020-02-01 23:39:17 +00:00
|
|
|
command =
|
|
|
|
"'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'";
|
|
|
|
regexp = "'\\[?{" + ''
|
|
|
|
"name": "(?P<name>.*)", "address": "(?P<email>.+)", "name-addr": ".*"''
|
2019-04-10 12:39:25 +00:00
|
|
|
+ "}[,\\]]?'";
|
2019-02-05 06:03:04 +00:00
|
|
|
shellcommand_external_filtering = "False";
|
|
|
|
};
|
2021-10-09 09:14:08 +00:00
|
|
|
example = literalExpression ''
|
2019-02-05 06:03:04 +00:00
|
|
|
{
|
|
|
|
type = "shellcommand";
|
|
|
|
command = "abook --mutt-query";
|
|
|
|
regexp = "'^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)'";
|
|
|
|
ignorecase = "True";
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2020-02-01 23:39:17 +00:00
|
|
|
Contact completion configuration as expected per alot.
|
2023-06-30 23:30:13 +00:00
|
|
|
See [alot's wiki](http://alot.readthedocs.io/en/latest/configuration/contacts_completion.html) for
|
2020-02-01 23:39:17 +00:00
|
|
|
explanation about possible values.
|
2019-02-05 06:03:04 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-08-06 10:05:46 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2018-08-06 10:05:46 +00:00
|
|
|
Extra settings to add to this Alot account configuration.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf config.notmuch.enable {
|
2020-02-01 23:39:17 +00:00
|
|
|
alot.sendMailCommand = mkOptionDefault (if config.msmtp.enable then
|
|
|
|
"msmtpq --read-envelope-from --read-recipients"
|
|
|
|
else
|
|
|
|
null);
|
2018-08-06 10:05:46 +00:00
|
|
|
};
|
|
|
|
}
|