Yejun Su

Emacs $PATH

The following configuration enables Emacs to inherit the correct $PATH from the shell in all cases:

My shell is located at /run/current-system/sw/bin/fish, so the configuration is:

(use-package exec-path-from-shell
  :pin nongnu
  :if (memq window-system '(mac ns x))
  :init
  (setq shell-file-name "/run/current-system/sw/bin/fish")
  :config
  (dolist (var '("__fish_nixos_env_preinit_sourced"
                 "__NIX_DARWIN_SET_ENVIRONMENT_DONE"
                 "__HM_SESS_VARS_SOURCED"))
    (add-to-list 'exec-path-from-shell-variables var))
  (exec-path-from-shell-initialize))

(use-package envrc
  :pin melpa
  :hook (after-init . envrc-global-mode))