Change:
Many Emacs packages, for instance mu4e, move their -files into a subdirectory of . Nixpkgs currently only adds all files located in to the load-path but does not add the files in its subdirectories. This currently makes mu4e from Nixpkgs unusable (by default). We have to fix this snippet of code: E.g. will not make mu4e available within GNU Emacs.
I'll give it a try in a few minutes
Why can't somebody just fix mu4e instead of making emacs startup slower? Like make a wrapper for it like has for Agda or just put files into a correct place like package does? I see wanted to do this, but then changed its mind :(
This actually seems to be the default behavior for Emacs - at least for packages it ships with. See for an example or run to check the default value of (it includes subdirectories)
I see. Okay then. Still, personally I would prefer packages to separate their emacs things into a separate package or at least a separate output.
This broke the package which have subdirectories that include "non-public" files, which gets required as the wrong package for , etc. See Perhaps this should be revisited? I am not sure if this potentially breaks some other packages.
I have reverted this locally (or at least I think so, could be that the change was not propagated somehow), but still seems like paths are , I see a lot of projects test directories being to the e.t.c.
Here is an example of bad load-path and this is just a subset of them all, nix-shell to reproduce:

Discussion:
<del> ;;; NixOS specific load-path (setq load-path (append (reverse (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/")) (split-string (or (getenv "NIX_PROFILES") "")))) load-path)) </del> <ins> (defun nix--profile-paths () "Returns a list of all paths in the NIX_PROFILES environment variable, ordered from more-specific (the user profile) to the least specific (the system profile)" (reverse (split-string (or (getenv "NIX_PROFILES") "")))) ;;; Extend `load-path' to search for elisp files in subdirectories of ;;; all folders in `NIX_PROFILES'. Also search for one level of ;;; subdirectories in these directories to handle multi-file libraries ;;; like `mu4e'.' (require 'seq) (let* ((subdirectory-sites (lambda (site-lisp) (when (file-exists-p site-lisp) (seq-filter (lambda (f) (file-directory-p (file-truename f))) ;; Returns all files in `site-lisp', excluding `.' and `..' (directory-files site-lisp 'full "^([^.]|.[^.]|...)"))))) (paths (apply #'append (mapcar (lambda (profile-dir) (let ((site-lisp (concat profile-dir "/share/emacs/site-lisp/"))) (cons site-lisp (funcall subdirectory-sites site-lisp)))) (nix--profile-paths))))) (setq load-path (append paths load-path))) </ins> ;;; Make `woman' find the man pages (eval-after-load 'woman '(setq woman-manpath <del> (append (reverse (mapcar (lambda (x) (concat x "/share/man/")) (split-string (or (getenv "NIX_PROFILES") "")))) </del> <ins> (append (mapcar (lambda (x) (concat x "/share/man/")) (nix--profile-paths)) </ins> woman-manpath))) ;;; Make tramp work for remote NixOS machines (eval-after-load 'tramp <ins> ;; TODO: We should also add the other `NIX_PROFILES' to this path. ;; However, these are user-specific, so we would need to discover ;; them dynamically after connecting via `tramp' </ins> '(add-to-list 'tramp-remote-path "/run/current-system/sw/bin")) ;;; C source directory

;;; from: /nix/store/<hash>-emacs-<version>/share/emacs/site-lisp/site-start.el ;;; to:   /nix/store/<hash>-emacs-<version>/share/emacs/<version>/src/ (let ((emacs <del> (file-name-directory                      ;; .../emacs/ (directory-file-name                     ;; .../emacs/site-lisp (file-name-directory load-file-name)))) ;; .../emacs/site-lisp/ </del> <ins> (file-name-directory                      ; .../emacs/ (directory-file-name                     ; .../emacs/site-lisp (file-name-directory load-file-name)))) ; .../emacs/site-lisp/ </ins> (version (file-name-as-directory (concat