SLY: Preload all Nyxt dependencies for fastest startup.
parent
4091831038
commit
b4248b4226
|
@ -1,5 +1,18 @@
|
||||||
(require 'patch-sly)
|
(require 'patch-sly)
|
||||||
|
|
||||||
|
(defun ambrevar/prepare-sbcl-for-nyxt () ; TODO: Move this to a cl-flet.
|
||||||
|
(let ((file (make-temp-file "sbcl")))
|
||||||
|
(with-temp-file file
|
||||||
|
(insert
|
||||||
|
(format "%S"
|
||||||
|
'(mapc #'asdf:load-system
|
||||||
|
(delete-if (lambda (s)
|
||||||
|
(string= "nyxt" (subseq s 0 (min (length s) 4))))
|
||||||
|
(append
|
||||||
|
(asdf:system-depends-on (asdf:find-system :nyxt))
|
||||||
|
(asdf:system-depends-on (asdf:find-system :nyxt/gtk))))))))
|
||||||
|
file))
|
||||||
|
|
||||||
(when (executable-find "lisp-repl-core-dumper")
|
(when (executable-find "lisp-repl-core-dumper")
|
||||||
;; Warning: ,restart-lisp does not take changes into account, the buffer must be re-created.
|
;; Warning: ,restart-lisp does not take changes into account, the buffer must be re-created.
|
||||||
(setq sly-lisp-implementations
|
(setq sly-lisp-implementations
|
||||||
|
@ -12,12 +25,14 @@
|
||||||
;; glib is needed to export GIO_EXTRA_MODULES.
|
;; glib is needed to export GIO_EXTRA_MODULES.
|
||||||
"--ad-hoc" "glib" "glib-networking" "gsettings-desktop-schemas"
|
"--ad-hoc" "glib" "glib-networking" "gsettings-desktop-schemas"
|
||||||
"gnupg" "--" "sbcl"))
|
"gnupg" "--" "sbcl"))
|
||||||
;; Faster, but not pure. TODO: Can we purify it? Run it in a container?
|
(sbcl-nyxt-fast ;; Faster, but not pure. TODO: Can we purify it? Run it in a container? Try `env -i bash --noprofile --norc...`.
|
||||||
(sbcl-nyxt-fast
|
;; TODO: Add easy way to reload: must delete profile. No need to delete dump if we use -f.
|
||||||
|
;; TODO: Extract to a separate function.
|
||||||
(lambda ()
|
(lambda ()
|
||||||
;; TODO: Replace root when source has changed?
|
;; TODO: Replace root when guix.scm is newer.
|
||||||
(let ((root (expand-file-name "~/.guix-temp-profiles/nyxt"))
|
(let ((root (expand-file-name "~/.guix-temp-profiles/nyxt"))
|
||||||
(cache (expand-file-name "~/.cache/lisp-repl-core-nyxt")))
|
(cache (expand-file-name "~/.cache/lisp-repl-core-nyxt"))
|
||||||
|
(setup-file (ambrevar/prepare-sbcl-for-nyxt)))
|
||||||
(unless (file-exists-p root)
|
(unless (file-exists-p root)
|
||||||
(make-directory (file-name-directory root) :parents)
|
(make-directory (file-name-directory root) :parents)
|
||||||
(call-process "guix" nil nil nil
|
(call-process "guix" nil nil nil
|
||||||
|
@ -32,8 +47,9 @@
|
||||||
"coreutils"
|
"coreutils"
|
||||||
"lisp-repl-core-dumper"
|
"lisp-repl-core-dumper"
|
||||||
"--" "env" (concat "LISP_REPL_CORE_PATH=" cache)
|
"--" "env" (concat "LISP_REPL_CORE_PATH=" cache)
|
||||||
"lisp-repl-core-dumper" "sbcl"))
|
"lisp-repl-core-dumper" "-f" "-g" (format "--load %s" setup-file) "sbcl")
|
||||||
;; TODO: Include Nyxt Lisp deps in core dump?
|
(let ((delete-by-moving-to-trash nil))
|
||||||
|
(delete-file setup-file)))
|
||||||
`(("bash" "-c" ,(concat
|
`(("bash" "-c" ,(concat
|
||||||
(format "source '%s/etc/profile'" root)
|
(format "source '%s/etc/profile'" root)
|
||||||
" && LISP_REPL_CORE_PATH=" cache
|
" && LISP_REPL_CORE_PATH=" cache
|
||||||
|
|
Loading…
Reference in New Issue