Avoid mktemp

Nix promises to run us in an (empty) temporary directory. So we should
not need mktemp, we can just use deterministic names.

Our temporary directory should already not be leaking into the
output (and we enforce that for the profile), so this should just be
cleanup that makes debugging slightly easier.
This commit is contained in:
Marien Zwart 2024-07-20 15:11:36 +10:00
parent d81e519c86
commit 51e61c24fe
No known key found for this signature in database
3 changed files with 9 additions and 7 deletions

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
mkdir $out $out/loader $out/doomdir $out/profile $out/straight
mkdir $out $out/loader $out/doomdir $out/profile $out/straight doomlocaldir home
ln -s $doomDir/* $out/doomdir/
# yasnippet logs an error at startup if snippets/ does not exist.
if ! [[ -e $out/doomdir/snippets ]]; then
@ -35,14 +35,14 @@ ln -sf $doomIntermediates/packages.el $out/doomdir/
export DOOMDIR=$out/doomdir
# DOOMLOCALDIR must be writable, Doom creates some subdirectories.
export DOOMLOCALDIR=$(mktemp -d)
export DOOMLOCALDIR="$PWD/doomlocaldir"
if [[ -n "$profileName" ]]; then
export DOOMPROFILELOADFILE=$out/loader/init.el
$runtimeShell $doomSource/bin/doomscript $buildProfileLoader \
${noProfileHack:+-u} -n "$profileName" -b "$out"
# With DOOMPROFILE set, doom-state-dir and friends are HOME-relative.
export HOME=$(mktemp -d)
export HOME="$PWD/home"
export DOOMPROFILE="$profileName";
fi
$runtimeShell $doomSource/bin/doomscript $buildProfile \

View file

@ -36,7 +36,7 @@ runCommandLocal name
)
# Set DOOMLOCALDIR somewhere harmless to stop Doom from trying to create it somewhere read-only.
''
mkdir $out
export DOOMLOCALDIR=$(mktemp -d)
mkdir $out doomlocaldir
export DOOMLOCALDIR="$PWD/doomlocaldir"
$runtimeShell $doomSource/bin/doomscript $script ${scriptArgs}
''

View file

@ -40,7 +40,8 @@
# TODO: figure out why this is necessary (there may be a better
# solution).
preBuild = ''
export HOME=$(mktemp -d)
mkdir home
export HOME="$PWD/home"
'';
# TODO: set this properly (melpa2nix requires it).
commit = "unset";
@ -208,7 +209,8 @@
# Make it byte-compile (see auctex)
company-auctex = esuper.company-auctex.overrideAttrs (attrs: {
preBuild = (attrs.preBuild or "") + ''
export HOME=$(mktemp -d)
mkdir home
export HOME="$PWD/home"
'';
});
# Make it byte-compile.