Skip to content

Commit b957bf5

Browse files
committed
Keep Nix runtime selection ephemeral
1 parent bc3a348 commit b957bf5

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

flake.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,17 @@
3535
export HOME="$TMPDIR/home"
3636
export XDG_DATA_HOME="$HOME/.local/share"
3737
mkdir -p "$HOME"
38+
runtime_root="$XDG_DATA_HOME/autolith/runtimes/${pkgs.sbcl.version}"
39+
mkdir -p "$runtime_root"
3840
autolith --version >/dev/null
41+
test ! -e "$runtime_root/command"
42+
printf '%s\n' /managed/sbcl > "$runtime_root/command"
3943
test "$(autolith --version)" = "autolith ${autolith.autolithSystem.version}"
44+
test "$(cat "$runtime_root/command")" = /managed/sbcl
45+
printf '%s\n' \
46+
"${autolith.runtime}/bin/sbcl" > "$runtime_root/command"
47+
autolith --version >/dev/null
48+
test ! -e "$runtime_root/command"
4049
4150
export COLORLISP_NATIVE_LIBRARY="${autolith.colorlispNativeLibrary}/lib/libcolorlisp-tree-sitter.so"
4251
"${autolith.runtime}/bin/sbcl" \

nix/package.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,17 @@ pkgs.writeShellApplication {
339339
printf '%s %s\n' \
340340
"${expectedSbclVersion}" \
341341
"${expectedSbclSourceHash}" > "$runtime_root/source.identity"
342-
printf '%s\n' "${runtime}/bin/sbcl" > "$runtime_root/command"
342+
# The Nix runtime needs companion libraries and environment from this
343+
# wrapper. Its bare persisted SBCL path would poison source-based tooling.
344+
recorded_runtime=
345+
if [ -r "$runtime_root/command" ]; then
346+
IFS= read -r recorded_runtime < "$runtime_root/command" || recorded_runtime=
347+
fi
348+
case "$recorded_runtime" in
349+
/nix/store/*-sbcl-with-packages*/bin/sbcl)
350+
rm -f "$runtime_root/command"
351+
;;
352+
esac
343353
344354
recovery_core="$data_home/autolith/recovery/autolith-recovery.core"
345355
active_core="$data_home/autolith/active/autolith-active.core"

0 commit comments

Comments
 (0)