Use doomscript instead of cli.el for profile build

Our cli.el ended up in the profile used at runtime. Although we could
have fixed overwriting a user's cli.el by appending to it, that still
would have leaked our build commands into the build.

This approach should be equivalent and reduces our profile modifications
to replacing packages.el (which is kind of the point) and prepending to
init.el (unfortunate, but seemingly necessary).
This commit is contained in:
Marien Zwart 2024-04-25 16:23:55 +10:00
parent e41bb2e0e5
commit bc288fad83
No known key found for this signature in database
4 changed files with 74 additions and 65 deletions

View file

@ -251,7 +251,6 @@ let
fi
ln -sf ${finalInitFile} $out/init.el
ln -sf ${doomIntermediates}/packages.el $out/
ln -sf ${./cli2.el} $out/cli.el
'';
# Step 5: build a Doom profile and profile loader using Emacs from step 3 and
@ -280,13 +279,13 @@ let
# Prevent error on Emacs shutdown writing empty build cache.
mkdir $DOOMLOCALDIR/straight
${runtimeShell} ${doomSource}/bin/doom build-profile-loader-for-nix-build \
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile-loader} \
-n "${profileName}" -p "$out/profile" -d "${finalDoomDir}"
# With DOOMPROFILE set, doom-state-dir and friends are HOME-relative.
export HOME=$(mktemp -d)
export DOOMPROFILE='${profileName}';
${runtimeShell} ${doomSource}/bin/doom build-profile-for-nix-build
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile}
# Similar to audit-tmpdir.sh in nixpkgs.
if grep -q -F "$TMPDIR/" -r $out; then