mail/aerc: Use home-manager module (mostly)
This does not use the home-manager provided account module, because it does not support notmuch, LOGIN authentication and special characters in user names.
This commit is contained in:
parent
71308a9284
commit
47c5bd5338
|
@ -44,7 +44,7 @@ in
|
|||
|
||||
signature.text = signaturePersonal;
|
||||
|
||||
aerc.enable = true;
|
||||
aerc-sbruder.enable = true;
|
||||
mbsync = {
|
||||
enable = true;
|
||||
#flatten = ".";
|
||||
|
@ -79,7 +79,7 @@ in
|
|||
|
||||
signature.text = signaturePersonal;
|
||||
|
||||
aerc.enable = true;
|
||||
aerc-sbruder.enable = true;
|
||||
};
|
||||
tu-dresden = rec {
|
||||
realName = "Simon Bruder";
|
||||
|
@ -106,7 +106,7 @@ in
|
|||
|
||||
signature.text = signaturePersonal;
|
||||
|
||||
aerc.enable = true;
|
||||
aerc-sbruder.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
package = pkgs.aerc;
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
accounts.email.accounts = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options.aerc.enable = lib.mkEnableOption "aerc";
|
||||
options.aerc-sbruder.enable = lib.mkEnableOption "aerc (custom implementation)";
|
||||
});
|
||||
};
|
||||
};
|
||||
config = {
|
||||
home.packages = [
|
||||
package
|
||||
];
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
|
||||
xdg.configFile = {
|
||||
"aerc/accounts.conf".text = lib.generators.toINI { } (lib.mapAttrs
|
||||
# incomplete support for all configuration options!
|
||||
extraAccounts =
|
||||
(lib.mapAttrs
|
||||
(name: accountConfig: with accountConfig; let
|
||||
quoteMailAddress = lib.replaceChars [ "@" "\\" ] [ "%40" "%5C" ];
|
||||
# home-manager has no way to set if an account requires AUTH LOGIN
|
||||
|
@ -41,12 +38,12 @@ in
|
|||
from = "${realName} <${address}>";
|
||||
smtp-starttls = if smtp.tls.useStartTls then "yes" else "no";
|
||||
copy-to = "Sent";
|
||||
signature-file = pkgs.writeText "signature-${name}" signature.text;
|
||||
signature-file = toString (pkgs.writeText "signature-${name}" signature.text);
|
||||
pgp-key-id = gpg.key;
|
||||
pgp-auto-sign = gpg.signByDefault;
|
||||
pgp-opportunistic-encrypt = gpg.encryptByDefault;
|
||||
} // (lib.optionalAttrs notmuch.enable {
|
||||
query-map = pkgs.writeText "aerc-query-map" ''
|
||||
query-map = toString (pkgs.writeText "aerc-query-map" ''
|
||||
Archive=not tag:inbox and not tag:sent
|
||||
Git=tag:git
|
||||
INBOX=tag:inbox
|
||||
|
@ -56,7 +53,7 @@ in
|
|||
Trash=tag:deleted
|
||||
eBay Kleinanzeigen=tag:kleinanzeigen
|
||||
eBay=tag:ebay
|
||||
'';
|
||||
'');
|
||||
exclude-tags = lib.concatStringsSep "," [
|
||||
"archived"
|
||||
"deleted"
|
||||
|
@ -64,10 +61,10 @@ in
|
|||
];
|
||||
}))
|
||||
(lib.filterAttrs
|
||||
(_: config: config.aerc.enable)
|
||||
(_: config: config.aerc-sbruder.enable)
|
||||
config.accounts.email.accounts));
|
||||
|
||||
"aerc/aerc.conf".text = lib.generators.toINI { } {
|
||||
extraConfig = {
|
||||
general = {
|
||||
pgp-provider = "gpg"; # internal does not work
|
||||
|
||||
|
@ -124,10 +121,10 @@ in
|
|||
};
|
||||
|
||||
filters = {
|
||||
"subject,~^\\[PATCH" = "awk -f ${package}/share/aerc/filters/hldiff";
|
||||
"subject,~^\\[PATCH" = "awk -f ${pkgs.aerc}/share/aerc/filters/hldiff";
|
||||
"text/plain" = "${./colorize}"; # taken from upstream and patched
|
||||
"text/html" = "html"; # internal filter
|
||||
"text/calendar" = "${pkgs.python3.withPackages (ps: with ps; [ vobject ])}/bin/python ${package}/share/aerc/filters/show-ics-details.py"; # hacky fix for broken nix support
|
||||
"text/calendar" = "${pkgs.python3.withPackages (ps: with ps; [ vobject ])}/bin/python ${pkgs.aerc}/share/aerc/filters/show-ics-details.py"; # hacky fix for broken nix support
|
||||
};
|
||||
|
||||
triggers = {
|
||||
|
@ -137,8 +134,8 @@ in
|
|||
templates = { };
|
||||
};
|
||||
|
||||
"aerc/binds.conf".text = lib.generators.toINIWithGlobalSection { } {
|
||||
globalSection = {
|
||||
extraBinds = {
|
||||
global = {
|
||||
# Binds are of the form <key sequence> = <command to run>
|
||||
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
|
||||
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
|
||||
|
@ -147,7 +144,6 @@ in
|
|||
"<C-t>" = ":term<Enter>";
|
||||
};
|
||||
|
||||
sections = {
|
||||
messages = {
|
||||
"q" = ":quit<Enter>";
|
||||
|
||||
|
@ -272,12 +268,9 @@ in
|
|||
"<C-n>" = ":next-tab<Enter>";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"aerc/stylesets/default".text = lib.concatStrings
|
||||
(lib.mapAttrsToList
|
||||
(k: v: "${k} = ${if lib.isBool v then (if v then "true" else "false") else toString v}\n")
|
||||
{
|
||||
stylesets = {
|
||||
default = {
|
||||
"*.selected.reverse" = true;
|
||||
|
||||
"title.reverse" = true;
|
||||
|
@ -303,7 +296,15 @@ in
|
|||
"tab.fg" = 0;
|
||||
|
||||
"completion_default.bg" = 0;
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#quoteMailAddress = lib.replaceChars [ "@" "\\" ] [ "%40" "%5C" ];
|
||||
## home-manager has no way to set if an account requires AUTH LOGIN
|
||||
## this emulats this by setting a list of known providers that do require it
|
||||
#requiresLogin = lib.elem
|
||||
# (lib.elemAt (lib.strings.splitString "@" address) 1)
|
||||
# [ "mailbox.tu-dresden.de" ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue