As I dedicate myself to Eshell more, especially on this Macbook which violates all my muscle memory in, a few tweaks are needed to be able to find all my commands:

(defun mak::flatten-list (l)
  (apply #'append l))

(defun mak::locally-installed-programs ()
    (lambda (d) (list (concat d "/bin")
                      (concat d "/sbin")))
    (directory-files "~/local" t directory-files-no-dot-files-regexp))))

(defun mak::generate-path-env-var ()
  ;; The order of this list is critical:
  ;; 1) Scripts I wrote myself
  ;; 2) Programs installed privately (source)
  ;; 3) Programs installed privately (golang)
  ;; 4) Programs installed system-wide
  ;; 5) Stock OS commands
  (mapcar #'expand-file-name
            ("/usr/local/bin" "/usr/local/sbin")
            ("/usr/bin" "/usr/sbin" "/bin" "/sbin")))))

Let's use IELM to test those functions, since we've not used it before and it's neat to see.

ELISP> (mak::flatten-list '((a) (b c) (d e f) (g (h) i)))
(a b c d e f g

ELISP> (mak::locally-installed-programs)
("/Users/mak/local/emacs/bin" "/Users/mak/local/emacs/sbin")

ELISP> (mak::generate-path-env-var)
("/Users/mak/bin" "/Users/mak/local/emacs/bin" "/Users/mak/local/emacs/sbin" ...)

You'll notice that flatten only goes one level deep. I'm okay with that for now, but I anticipate Future Me hating Present Me for this.

(defun mak::set-path-env-var ()
  (setenv "PATH"
          (string-join (mak::generate-path-env-var) ":")))

(add-hook 'eshell-mode-hook 'mak::set-path-env-var)

And there we have it! Eshell will now generate and set the appropriate $PATH variable when it starts.