Revert PR #408
This reverts the commits - "alot: change msmtp default command"8e798e4c28
- "astroid: init"736e340bde
because they include changes that break some configurations and some options that are misplaced.
This commit is contained in:
parent
8e798e4c28
commit
22568a3d26
|
@ -380,7 +380,6 @@ in
|
|||
type = types.attrsOf (types.submodule [
|
||||
mailAccountOpts
|
||||
(import ../programs/alot-accounts.nix)
|
||||
(import ../programs/astroid-accounts.nix)
|
||||
(import ../programs/mbsync-accounts.nix)
|
||||
(import ../programs/msmtp-accounts.nix)
|
||||
(import ../programs/notmuch-accounts.nix)
|
||||
|
|
|
@ -27,7 +27,6 @@ let
|
|||
./misc/xdg.nix
|
||||
./programs/alot.nix
|
||||
./programs/autorandr.nix
|
||||
./programs/astroid.nix
|
||||
./programs/bash.nix
|
||||
./programs/beets.nix
|
||||
./programs/browserpass.nix
|
||||
|
|
|
@ -25,7 +25,7 @@ with lib;
|
|||
config = mkIf config.notmuch.enable {
|
||||
alot.sendMailCommand = mkOptionDefault (
|
||||
if config.msmtp.enable
|
||||
then cfg.msmtp.sendCommand
|
||||
then "msmtpq --read-envelope-from --read-recipients"
|
||||
else null
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
|
||||
options.astroid = {
|
||||
enable = mkEnableOption "Astroid";
|
||||
|
||||
sendMailCommand = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
Command to send a mail. If msmtp is enabled for the account,
|
||||
then this is set to
|
||||
<command>msmtpq --read-envelope-from --read-recipients</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = ''
|
||||
{
|
||||
select_query = "";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Extra settings to add to this astroid account configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
config = mkIf config.notmuch.enable {
|
||||
astroid.sendMailCommand = mkOptionDefault (
|
||||
if config.msmtp.enable
|
||||
then "msmtpq --read-envelope-from --read-recipients"
|
||||
else null
|
||||
);
|
||||
};
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
{
|
||||
"astroid": {
|
||||
"config": {
|
||||
"version": "11"
|
||||
},
|
||||
"notmuch_config": "\/home\/teto\/.notmuch-config",
|
||||
"debug": {
|
||||
"dryrun_sending": "false"
|
||||
},
|
||||
"hints": {
|
||||
"level": "0"
|
||||
},
|
||||
"log": {
|
||||
"syslog": "false",
|
||||
"stdout": "true",
|
||||
"level": "info"
|
||||
}
|
||||
},
|
||||
"accounts": {
|
||||
"charlie": {
|
||||
"name": "Charlie Root",
|
||||
"email": "root@localhost",
|
||||
"gpgkey": "",
|
||||
"always_gpg_sign": "false",
|
||||
"sendmail": "msmtp -i -t",
|
||||
"default": "true",
|
||||
"save_sent": "false",
|
||||
"save_sent_to": "\/home\/root\/Mail\/sent\/cur\/",
|
||||
"additional_sent_tags": "",
|
||||
"save_drafts_to": "\/home\/root\/Mail\/drafts\/",
|
||||
"signature_separate": "false",
|
||||
"signature_file": "",
|
||||
"signature_file_markdown": "",
|
||||
"signature_default_on": "true",
|
||||
"signature_attach": "false",
|
||||
"select_query": ""
|
||||
}
|
||||
},
|
||||
"startup": {
|
||||
"queries": {
|
||||
"inbox": "tag:inbox"
|
||||
}
|
||||
},
|
||||
"terminal": {
|
||||
"height": "10",
|
||||
"font_description": "default"
|
||||
},
|
||||
"thread_index": {
|
||||
"page_jump_rows": "6",
|
||||
"sort_order": "newest",
|
||||
"cell": {
|
||||
"font_description": "default",
|
||||
"line_spacing": "2",
|
||||
"date_length": "10",
|
||||
"message_count_length": "4",
|
||||
"authors_length": "20",
|
||||
"subject_color": "#807d74",
|
||||
"subject_color_selected": "#000000",
|
||||
"background_color_selected": "",
|
||||
"background_color_marked": "#fff584",
|
||||
"background_color_marked_selected": "#bcb559",
|
||||
"tags_length": "80",
|
||||
"tags_upper_color": "#e5e5e5",
|
||||
"tags_lower_color": "#333333",
|
||||
"tags_alpha": "0.5",
|
||||
"hidden_tags": "attachment,flagged,unread"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"time": {
|
||||
"clock_format": "local",
|
||||
"same_year": "%b %-e",
|
||||
"diff_year": "%x"
|
||||
}
|
||||
},
|
||||
"editor": {
|
||||
"cmd": "\/nix\/store\/svbc11jg7aq9c2mdz233cadxnqnqdckx-vim-8.1.0146\/bin\/vim -g --servername %2 --socketid %3 -f -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1",
|
||||
"external_editor": "false",
|
||||
"charset": "utf-8",
|
||||
"save_draft_on_force_quit": "true",
|
||||
"attachment_words": "attach",
|
||||
"attachment_directory": "~",
|
||||
"markdown_processor": "marked"
|
||||
},
|
||||
"mail": {
|
||||
"reply": {
|
||||
"quote_line": "Excerpts from %1's message of %2:",
|
||||
"mailinglist_reply_to_sender": "true"
|
||||
},
|
||||
"forward": {
|
||||
"quote_line": "Forwarding %1's message of %2:",
|
||||
"disposition": "inline"
|
||||
},
|
||||
"sent_tags": "sent",
|
||||
"message_id_fqdn": "",
|
||||
"message_id_user": "",
|
||||
"user_agent": "default",
|
||||
"send_delay": "2",
|
||||
"close_on_success": "false",
|
||||
"format_flowed": "false"
|
||||
},
|
||||
"poll": {
|
||||
"interval": "60",
|
||||
"always_full_refresh": "false"
|
||||
},
|
||||
"attachment": {
|
||||
"external_open_cmd": "xdg-open"
|
||||
},
|
||||
"thread_view": {
|
||||
"open_html_part_external": "false",
|
||||
"preferred_type": "plain",
|
||||
"preferred_html_only": "false",
|
||||
"allow_remote_when_encrypted": "false",
|
||||
"open_external_link": "xdg-open",
|
||||
"default_save_directory": "~",
|
||||
"indent_messages": "false",
|
||||
"gravatar": {
|
||||
"enable": "true"
|
||||
},
|
||||
"mark_unread_delay": "0.5",
|
||||
"expand_flagged": "true"
|
||||
},
|
||||
"crypto": {
|
||||
"gpg": {
|
||||
"path": "gpg2",
|
||||
"always_trust": "true",
|
||||
"enabled": "true"
|
||||
}
|
||||
},
|
||||
"saved_searches": {
|
||||
"show_on_startup": "false",
|
||||
"save_history": "true",
|
||||
"history_lines_to_show": "15",
|
||||
"history_lines": "1000"
|
||||
}
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
# look at dev/get_keys.py to generate a default mappings
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.astroid;
|
||||
|
||||
astroidAccounts = filterAttrs (n: v: v.notmuch.enable)
|
||||
(config.accounts.email.accounts);
|
||||
|
||||
sendMailCommand = account:
|
||||
if account.astroid.sendMailCommand != null then account.astroid.sendMailCommand
|
||||
else
|
||||
if account.msmtp.enable then cfg.msmtp.sendCommand else "";
|
||||
|
||||
accountAttr = account: with account; {
|
||||
email = address;
|
||||
name = realName;
|
||||
sendmail = sendMailCommand account;
|
||||
additional_sent_tags = "";
|
||||
default = if primary then "true" else "false";
|
||||
save_drafts_to = folders.drafts;
|
||||
save_sent = "true";
|
||||
save_sent_to = folders.sent;
|
||||
select_query = "";
|
||||
}
|
||||
// optionalAttrs (signature.showSignature != "none") {
|
||||
signature_attach= if (signature.showSignature == "attach") then "true" else "false";
|
||||
signature_default_on = if (signature.showSignature != "none") then "true" else "false";
|
||||
signature_file = pkgs.writeText "signature.txt" signature.text;
|
||||
signature_file_markdown = "false";
|
||||
signature_separate = "true"; # prepends '--\n' to the signature
|
||||
}
|
||||
// optionalAttrs (gpg != null) {
|
||||
always_gpg_sign = if gpg.signByDefault then "true" else "false";
|
||||
gpgkey = gpg.key;
|
||||
}
|
||||
// astroid.extraConfig
|
||||
;
|
||||
|
||||
# See https://github.com/astroidmail/astroid/wiki/Configuration-Reference
|
||||
configFile = mailAccounts: let
|
||||
template = builtins.fromJSON (builtins.readFile ./astroid-config-template.json);
|
||||
astroidConfig =
|
||||
recursiveUpdate (template // {
|
||||
astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc";
|
||||
accounts = mapAttrs (name: account: (accountAttr account) ) astroidAccounts;
|
||||
crypto.gpg.path = "${pkgs.gnupg}/bin/gpg";
|
||||
}
|
||||
// cfg.extraConfig
|
||||
)
|
||||
cfg.externalEditor;
|
||||
in
|
||||
builtins.toJSON astroidConfig;
|
||||
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
programs.astroid = {
|
||||
enable = mkEnableOption "Astroid";
|
||||
|
||||
pollScript = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = ''
|
||||
mbsync gmail
|
||||
'';
|
||||
description = ''
|
||||
Script to run to fetch/update mails.
|
||||
'';
|
||||
};
|
||||
|
||||
externalEditor = mkOption {
|
||||
type = types.str;
|
||||
default = ''
|
||||
gvim -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1
|
||||
'';
|
||||
# converts it into json that can be appended to the config
|
||||
apply = cmd:
|
||||
{
|
||||
editor = {
|
||||
"external_editor" = "true";
|
||||
"cmd" = cmd;
|
||||
};
|
||||
};
|
||||
|
||||
example = ''
|
||||
nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1
|
||||
'';
|
||||
description = ''
|
||||
You can use %1 / %2 / %3 to refer respectively to:
|
||||
- filename
|
||||
- servername
|
||||
- socketid
|
||||
See <link xlink:href='https://github.com/astroidmail/astroid/wiki/Customizing-editor' />
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
poll.interval = 0;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
JSON config that will override the default astroid configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
home.packages = [ pkgs.astroid ];
|
||||
|
||||
xdg.configFile."astroid/config".source = pkgs.runCommandNoCC "out.json"
|
||||
{x = configFile astroidAccounts; } ''echo "$x" | ${pkgs.jq}/bin/jq . > $out'';
|
||||
|
||||
xdg.configFile."astroid/poll.sh" = {
|
||||
executable = true;
|
||||
text = "# Generated by home-manager\n" + cfg.pollScript;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -60,14 +60,6 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
sendCommand = mkOption {
|
||||
type = types.str;
|
||||
default = "msmtpq --read-envelope-from --read-recipients";
|
||||
description = ''
|
||||
Default command to use to send mail.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
Loading…
Reference in a new issue