diff --git a/HACKING.md b/HACKING.md index c9d8ddb..d7f1360 100644 --- a/HACKING.md +++ b/HACKING.md @@ -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 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? Doom forces my hand. I would prefer for just `packages.el` and possibly diff --git a/README.md b/README.md index 8eb16da..d14b99a 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,10 @@ source. 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` - Unstraightened does not attempt to use straight.el at all. Instead, it uses diff --git a/build-helpers/build-profile-loader b/build-helpers/build-profile-loader index 1a8f012..0d29325 100755 --- a/build-helpers/build-profile-loader +++ b/build-helpers/build-profile-loader @@ -18,14 +18,16 @@ (defcli! build-profile-loader ((profile-name ("-n" form) "Profile name.") (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." (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))))) + ("DOOMDIR" . ,profile-doom-dir) + ,@(when unset-profile '(("DOOMPROFILE" . nil))))))) (doom-profiles-save new-profiles))) (run! "build-profile-loader" (cdr (member "--" argv))) diff --git a/doom.nix b/doom.nix index 0723a52..220e15a 100644 --- a/doom.nix +++ b/doom.nix @@ -37,6 +37,8 @@ full ? false, /* Name of doom profile to use. */ profileName ? "nix", + /* Disable profile early in startup, so "normal" cache/state dirs are used. */ + noProfileHack ? false, callPackages, git, @@ -255,7 +257,7 @@ let # DOOMLOCALDIR must be writable, Doom creates some subdirectories. export DOOMLOCALDIR=$(mktemp -d) ${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. export HOME=$(mktemp -d)