Provide straight--build-cache
Add an (empty) straight.el build cache to the generated profile, and load it when Doom calls `doom-initialize-core-packages` (which normally does so by side effect). Unfortunately requires adding to pre-init: Doom overrides `straight-base-dir`, and we need to override that override. Partially fixes package help.
This commit is contained in:
parent
f150fe6c89
commit
80e6ef0d25
3 changed files with 17 additions and 8 deletions
|
|
@ -3,13 +3,15 @@
|
|||
|
||||
(defcli! build-profile-loader
|
||||
((profile-name ("-n" form) "Profile name.")
|
||||
(profile-directory ("-p" dir) "Profile data directory.")
|
||||
(base-directory ("-b" dir) "Base directory (for profile and straight).")
|
||||
(profile-doom-dir ("-d" dir) "DOOMDIR"))
|
||||
"Write Doom's profile loader."
|
||||
(let ((new-profiles `((,profile-name
|
||||
(user-emacs-directory . ,doom-emacs-dir)
|
||||
(doom-profile-data-dir . ,profile-directory)
|
||||
("DOOMDIR" . ,profile-doom-dir)))))
|
||||
(let* ((profile-directory (expand-file-name "profile/" base-directory))
|
||||
(new-profiles `((,profile-name
|
||||
(user-emacs-directory . ,doom-emacs-dir)
|
||||
(doom-profile-data-dir . ,profile-directory)
|
||||
(unstraightened--straight-base-dir . ,base-directory)
|
||||
("DOOMDIR" . ,profile-doom-dir)))))
|
||||
(doom-profiles-save new-profiles)))
|
||||
|
||||
(run! "build-profile-loader" (cdr (member "--" argv)))
|
||||
|
|
|
|||
4
doom.nix
4
doom.nix
|
|
@ -276,14 +276,14 @@ let
|
|||
# Required to avoid Doom erroring out at startup.
|
||||
nativeBuildInputs = [ git ];
|
||||
} ''
|
||||
mkdir $out $out/loader $out/profile
|
||||
mkdir $out $out/loader $out/profile $out/straight
|
||||
export DOOMPROFILELOADFILE=$out/loader/init.el
|
||||
export DOOMLOCALDIR=$(mktemp -d)
|
||||
# Prevent error on Emacs shutdown writing empty build cache.
|
||||
mkdir $DOOMLOCALDIR/straight
|
||||
|
||||
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile-loader} \
|
||||
-n "${profileName}" -p "$out/profile" -d "${finalDoomDir}"
|
||||
-n "${profileName}" -b "$out" -d "${finalDoomDir}"
|
||||
|
||||
# With DOOMPROFILE set, doom-state-dir and friends are HOME-relative.
|
||||
export HOME=$(mktemp -d)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@
|
|||
`straight-recipe-repositories' is set, but we do not want to set
|
||||
it. Just skip it entirely."
|
||||
:override #'doom-initialize-core-packages
|
||||
(doom-log "Assuming straight was already initialized"))
|
||||
(doom-log "nix-doom-emacs-unstraightened overriding core package init")
|
||||
;; doom-initialize-core-packages normally registers recipes, which loads the
|
||||
;; build cache by side effect, which leaves straight--build-cache available
|
||||
;; afterwards. Doom assumes this cache is available, so force a load here.
|
||||
(straight--load-build-cache))
|
||||
|
||||
(after! doom-packages
|
||||
(setq straight-base-dir unstraightened--straight-base-dir))
|
||||
|
||||
;; nix-doom-emacs-unstraightened additions end here.
|
||||
;; Original init.el follows.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue