Add hack to use non-profile paths

This unsets DOOMPROFILE from inside the profile loader, which should
result in Doom behaving as if we were not using profiles at all.

I'm marking this experimental in part because it feels like a hack, and
in part because this is not sufficient to fix `doom doctor`.
This commit is contained in:
Marien Zwart 2024-04-28 16:39:50 +10:00
parent 2babb2ed6a
commit e602ad8bed
No known key found for this signature in database
4 changed files with 15 additions and 3 deletions

View file

@ -17,6 +17,10 @@ its const-ness is not enforced but I'd prefer not to take advantage of that. I
also have not checked if writing the profile would work out of the box with this also have not checked if writing the profile would work out of the box with this
approach. approach.
`noProfileHack` unsets `DOOMPROFILE` from the profile loader. This feels like a
hack, but it does get us the usual `DOOMLOCALDIR`-relative `doom-cache-dir` and
friends back.
## Why put `doom-user-dir`/`DOOMDIR` in the Nix store? ## Why put `doom-user-dir`/`DOOMDIR` in the Nix store?
Doom forces my hand. I would prefer for just `packages.el` and possibly Doom forces my hand. I would prefer for just `packages.el` and possibly

View file

@ -143,6 +143,10 @@ source.
When migrating from "normal" Doom, you may need to move some files around. When migrating from "normal" Doom, you may need to move some files around.
If this bothers you, you can try setting `noProfileHack = true`. This makes
Unstraightened use the usual paths (relative to `doomLocalDir`), but is
experimental.
## Comparison to `nix-doom-emacs` ## Comparison to `nix-doom-emacs`
- Unstraightened does not attempt to use straight.el at all. Instead, it uses - Unstraightened does not attempt to use straight.el at all. Instead, it uses

View file

@ -18,14 +18,16 @@
(defcli! build-profile-loader (defcli! build-profile-loader
((profile-name ("-n" form) "Profile name.") ((profile-name ("-n" form) "Profile name.")
(base-directory ("-b" dir) "Base directory (for profile and straight).") (base-directory ("-b" dir) "Base directory (for profile and straight).")
(profile-doom-dir ("-d" dir) "DOOMDIR")) (profile-doom-dir ("-d" dir) "DOOMDIR")
(unset-profile ("-u") "Unset DOOMPROFILE at startup."))
"Write Doom's profile loader." "Write Doom's profile loader."
(let* ((profile-directory (expand-file-name "profile/" base-directory)) (let* ((profile-directory (expand-file-name "profile/" base-directory))
(new-profiles `((,profile-name (new-profiles `((,profile-name
(user-emacs-directory . ,doom-emacs-dir) (user-emacs-directory . ,doom-emacs-dir)
(doom-profile-data-dir . ,profile-directory) (doom-profile-data-dir . ,profile-directory)
(unstraightened--straight-base-dir . ,base-directory) (unstraightened--straight-base-dir . ,base-directory)
("DOOMDIR" . ,profile-doom-dir))))) ("DOOMDIR" . ,profile-doom-dir)
,@(when unset-profile '(("DOOMPROFILE" . nil)))))))
(doom-profiles-save new-profiles))) (doom-profiles-save new-profiles)))
(run! "build-profile-loader" (cdr (member "--" argv))) (run! "build-profile-loader" (cdr (member "--" argv)))

View file

@ -37,6 +37,8 @@
full ? false, full ? false,
/* Name of doom profile to use. */ /* Name of doom profile to use. */
profileName ? "nix", profileName ? "nix",
/* Disable profile early in startup, so "normal" cache/state dirs are used. */
noProfileHack ? false,
callPackages, callPackages,
git, git,
@ -255,7 +257,7 @@ let
# DOOMLOCALDIR must be writable, Doom creates some subdirectories. # DOOMLOCALDIR must be writable, Doom creates some subdirectories.
export DOOMLOCALDIR=$(mktemp -d) export DOOMLOCALDIR=$(mktemp -d)
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile-loader} \ ${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile-loader} \
-n "${profileName}" -b "$out" -d "${finalDoomDir}" -n "${profileName}" -b "$out" -d "${finalDoomDir}" ${optionalString noProfileHack "-u"}
# With DOOMPROFILE set, doom-state-dir and friends are HOME-relative. # With DOOMPROFILE set, doom-state-dir and friends are HOME-relative.
export HOME=$(mktemp -d) export HOME=$(mktemp -d)