Command-line email

Can we use Neovim as an email client? Yes, this is actually possible using Himalaya!

As a first step, though, we should enable Himalaya itself using Nix. home-manager provides a module for that. Without much ado:

{
  programs.himalaya = {
    enable = true;
  };
  accounts.email.accounts = {
    icloud = {
      primary = true;
      himalaya.enable = true;
      address = "srid@srid.ca";
      realName = "Sridhar Ratnakumar";
      userName = "happyandharmless";
      passwordCommand = "op item get iCloud --fields label=himalaya";
      imap = {
        host = "imap.mail.me.com";
        port = 993;
        tls.enable = true;
      };
      smtp = {
        host = "smtp.mail.me.com";
        port = 587;
        tls.enable = true;
      };
    };
  };
}

I added my iCloud account details. Note that passwordCommand uses 1Passwordโ€™s CLI tool, which uses Macโ€™s Touch ID authentication. I generated an App-specific password and put it under the โ€œhimalayaโ€ label of the iCloud entry in 1Password. As a result, we get a no-fuss way to read email!

/nix/store/v69nj9wxs9fafg6ni7a8k5zr81cwbwcc-2b9aw00bd2i9ngx1jiqf2l1dzlv1jabd-source/Software/cli/himalaya.png

https://github.com/srid/nixos-config/commit/1c188414286f5e81f0ea4a0e3ccd4ed555241f69

Vim extension

Installing the Vim extension is fairly simple:

      (pkgs.vimUtils.buildVimPlugin {
        name = "himalaya";
        src = inputs.himalaya + /vim;
      })

https://github.com/srid/nixos-config/commit/9bb76425b78906830a72846e005eb551b7a9eef4

The Vim extension is not bad. But it does bring up the Mac Touch ID prompt upon every email operation, which needs to be fixed.

#neovim #email