SLY: Purify environment of sbcl-nyxt implementation.

master
Pierre Neidhardt 2020-12-18 21:26:01 +01:00
parent f232f511c9
commit be6725e05a
1 changed files with 10 additions and 6 deletions

View File

@ -29,7 +29,8 @@
ad-hoc-args
command-args
&allow-other-keys)
"Wrapper over `ambrevar/guix-environment'."
"Like `ambrevar/guix-environment' but cache profile to speed up switch.
`lisp-repl-core-dumper' is used to speed up SBCL startup."
(let* ((load-mtime (when load
(file-attribute-modification-time (file-attributes load))))
(root (or (cl-getf args :root)
@ -51,17 +52,20 @@
(list :ad-hoc-args ad-hoc-args)
(list :command-args command-args)
args)))
`(("bash" "-c" ,(concat
(format "source '%s/etc/profile'" root)
" && LISP_REPL_CORE_PATH=" cache
" lisp-repl-core-dumper sbcl")))))
`((,@(unless (not (eq nil (cl-getf args :pure?)))
'("env" "-i"))
,(executable-find "bash") "--norc" "--noprofile" "-c"
,(concat
(format "source '%s/etc/profile'" root)
" && LISP_REPL_CORE_PATH=" cache
" lisp-repl-core-dumper sbcl")))))
(when (executable-find "lisp-repl-core-dumper")
;; Warning: ,restart-lisp does not take changes into account, the buffer must be re-created.
(setq sly-lisp-implementations
`((sbcl-ambrevar ("lisp-repl-core-dumper" "sbcl" "ambrevar"))
(sbcl ("lisp-repl-core-dumper" "sbcl"))
(sbcl-nyxt ;; Faster, but not pure. TODO: Can we purify it? Run it in a container? Try `env -i bash --noprofile --norc...`.
(sbcl-nyxt ;; Faster, but not pure. TODO: Run it in a container?
;; TODO: Add easy way to reload: must delete profile. No need to delete dump if we use -f.
(lambda ()
(cl-flet ((ambrevar/prepare-sbcl-for-nyxt