home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

Add module for aerc

Open lukasngl opened this issue 2 years ago • 3 comments

Description

Module for the aerc email client.

Related

  • #2894

Features

  • General configuration (cf. aerc-config(5)), via aerc.extraConfig
  • Configure local and global key bindings (cf. aerc-config(5)), via aerc.extraBinds
  • Configure theme with stylesets (cf. aerc-stylesets(7)), via aerc.stylesets
  • Create email templates (cf. aerc-templates(7)), via aerc.templates
  • Manual account configuration (cf. aerc-config(5)), via aerc.extraAccounts
  • Automagically setup smtp, imap, msmtp and maildir (via offlineimap or mbsync), using email.accounts.<name>
  • Populate accounts.conf with defaults from email.accounts.<name>. E.g., realName, address and folders
  • Contextual account configuration (cf. aerc-config(5)), via mail.accounts.<name>.extra{Accounts,Binds,Config}

Non-Features:

  • Write a query-map for notmuch (cf. aerc-notmuch(5)). If needed, one can just use pkgs.writeText, e.g.:
    accounts.email.<name>.aerc.extraConfig.query-map =
      pkgs.writeText "querymap" "inbox=tag:inbox and not tag:archived";
    
  • Setup maildir if neither offlineimap nor mbsync are enabled. The value email.accounts.<name>.maildir is not null by default. So there is no way of knowing if the user wants a setup with maildir, except if offlineimap or mbsync are enabled. If needed, one could just manually set it up like this:
    accounts.email.<name>.aerc.extraConfig.source =
      "maildir://${config.accounts.mailDirBasePath}/${config.accounts.<name>.maildir}"
    

Checklist

  • [X] Change is backwards compatible.

  • [X] Code formatted with ./format.

  • [X] Code tested through nix-shell --pure tests -A run.all.

  • [X] Test cases updated/added. See example.

  • [X] Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • [X] Added myself as module maintainer. See example.

    • [X] Added myself and the module files to .github/CODEOWNERS.

Note: One has to set programs.aerc.extraConfig.general.unsafe-accounts-conf = true;, otherwise aerc will throw an error.

Tested on NixOS 22.05, using smpt+tls+starttls and imap+tls, aswell as maildir via mbsync and sendmail via msmtp.

lukasngl avatar Jul 04 '22 13:07 lukasngl

Hi,

Thanks for the review. I moved the entries in .github/CODEOWNERS and squashed the commits to avoid clutter in the history.

lukasngl avatar Jul 06 '22 06:07 lukasngl

Hi, I just fixed the failing workflow step nix-build -A docs.jsonModuleMaintainers on my part. I used lib.maintainers instead of lib.hm.maintainers. (My branch is based on master and nix-build -A docs.jsonModuleMaintainers still fails locally, since @somasis is not in the maintainers set.)

lukasngl avatar Jul 25 '22 14:07 lukasngl

I've tried to test this but everytime I am greeted with the aerc assistant even when I enabled aerc for an account. Is that expected ? I got the warning about

extraConfig.general.unsafe-accounts-conf = true;

and I wonder if you could fully expand the warning to show "programs.aerc.extraConfig.general.unsafe-accounts-conf " and maybe link some page explaining what the setting entails.

NB: when in aerc configuration assistant, I cant find a way to exit it via mappings :/

teto avatar Aug 09 '22 22:08 teto

clearly this is a lot of effort. Let's merge and you can fix stuff later but it already looks good.

teto avatar Aug 11 '22 21:08 teto

I've tried to test this but everytime I am greeted with the aerc assistant even when I enabled aerc for an account. Is that expected ?

Depends, if programs.aerc.enable is not set, enabling an account will not create accounts.conf and thus aerc will start the assistant on launch. Furthermore, aerc will create the files aerc.conf and bindings.conf, if missing on launch. This means that home-manager wont't create the accounts.conf if the former files were already created and home-manager would need to overwrite them (and display a warning). Due to an issue fixed in 1, aerc.conf and binds.conf were always created if an account (and the programs itself) was enabled.

Maybe you could checkout the fork 3, make sure programs.aerc.enable is set to true and delete or backup (home-manager switch -b <extension>) aerc.conf and bindings.conf if there is a conflict.

If the issue persists please provide further information, so I can properly reproduce and investigate the issue.

I got the warning about

extraConfig.general.unsafe-accounts-conf = true;

and I wonder if you could fully expand the warning to show "programs.aerc.extraConfig.general.unsafe-accounts-conf " and maybe link some page explaining what the setting entails.

The warning was improved 2 and now explains the reasons and implications and cites the relevant manpage section (aerc-config(5)).

NB: when in aerc configuration assistant, I cant find a way to exit it via mappings :/

For me it was Ctrl+q to exit the assistant.

lukasngl avatar Aug 16 '22 11:08 lukasngl