Doom Emacs and mu4e

Tryng to run mu4e in Doom Emacs, I get the error

Cannot open load file: No such file or directory, mu4e

The troubleshooting section of the doomemacs manual mu4e chapter predicts that this will happen if

if you don’t run $ doom sync after installing mu through your package manager.

I have run doom sync, after having ensured that mu is in my $PATH.

It also states that

Some times the the mu package does not include mu4e

On my system:

$ readlink $(which mu)
/nix/store/c8lkpvz59n6nb1w6rrgrinf1s17k4bda-mu-1.6.10/bin/mu

$ ls /nix/store/c8lkpvz59n6nb1w6rrgrinf1s17k4bda-mu-1.6.10/share/emacs/site-lisp/mu4e
mu4e-actions.el   mu4e-context.el   mu4e-draft.el   mu4e-headers.el     mu4e-lists.el   mu4e-mark.el      mu4e-meta.el   mu4e-proc.el       mu4e-utils.el   mu4e-view-common.el   mu4e-view-gnus.el   org-mu4e.el
mu4e-actions.elc  mu4e-context.elc  mu4e-draft.elc  mu4e-headers.elc    mu4e-lists.elc  mu4e-mark.elc     mu4e-meta.elc  mu4e-proc.elc      mu4e-utils.elc  mu4e-view-common.elc  mu4e-view-gnus.elc  org-mu4e.elc
mu4e-compose.el   mu4e-contrib.el   mu4e.el         mu4e-icalendar.el   mu4e-main.el    mu4e-message.el   mu4e-org.el    mu4e-speedbar.el   mu4e-vars.el    mu4e-view.el          mu4e-view-old.el
mu4e-compose.elc  mu4e-contrib.elc  mu4e.elc        mu4e-icalendar.elc  mu4e-main.elc   mu4e-message.elc  mu4e-org.elc   mu4e-speedbar.elc  mu4e-vars.elc   mu4e-view.elc         mu4e-view-old.elc

so the mu package not including mu4e is not the problem.

The troubleshooting guide further suggests adding mu4e to load-path, thus:

(add-to-list 'load-path "your/path/to/mu4e")
;; if you installed it using your package manager
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
;; if you built from source
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")

Of course, none of these are appropriate for my nix-installed mu4e. Furthermore, the exact location in the Nix store will evolve with time.

How should I tell Doom Emacs about the location of my (home-manager installed) mu4e?

EDIT: I’m installing Doom Emacs itself outside of Nix, by cloning the Doom Emacs repo, following the installation instructions of Doom Emacs … because … well … things like this.

I have similar setup, and honestly do not have any extra setup for doom. It automatically detects NixOS and takes care of the rest.

Reference: ~payas/nixos: hosts/hermes/emacs.nix - sourcehut git

Hosted by Flying Circus.