                   load-path doom--initial-load-path
                   process-environment doom--initial-process-environment)
 
-    (require 'core-lib)
-    (require 'core-modules)
-
     ;; Load shell environment, optionally generated from 'doom env'
     (when (and (or (display-graphic-p)
                    (daemonp))
                (file-exists-p doom-env-file))
       (doom-load-envvars-file doom-env-file))
 
+    (require 'core-modules)
     (let (;; `doom-autoload-file' tells Emacs where to load all its functions
           ;; from. This includes everything in core/autoload/*.el and autoload
           ;; files in enabled modules.


;; Ensure `doom-core-dir' is in `load-path'
(add-to-list 'load-path (file-name-directory load-file-name))


;;

      url-cache-directory          (concat doom-cache-dir "url/")
      url-configuration-directory  (concat doom-etc-dir "url/")
      gamegrid-user-score-file-directory (concat doom-etc-dir "games/"))

;; HACK Stop sessions from littering the user directory
(defadvice! doom--use-cache-dir-a (session-id)
  :override #'emacs-session-filename
  (concat doom-cache-dir "emacs-session." session-id))


;;
