SLY: Regen Nyxt profile when guix.scm is newer.

master
Pierre Neidhardt 2020-12-18 19:12:38 +01:00
parent b4248b4226
commit f9248616f0
1 changed files with 22 additions and 19 deletions

View File

@ -18,42 +18,45 @@
(setq sly-lisp-implementations
`((sbcl-ambrevar ("lisp-repl-core-dumper" "sbcl" "ambrevar"))
(sbcl ("lisp-repl-core-dumper" "sbcl"))
;; Simple REPL environment (no container):
(sbcl-nyxt ("guix" "environment" "--pure"
"--preserve=^PERSONAL$" ; To find personal config, like engines and bookmarks.
"-l" ,(expand-file-name "~/common-lisp/nyxt/build-scripts/guix.scm")
;; glib is needed to export GIO_EXTRA_MODULES.
"--ad-hoc" "glib" "glib-networking" "gsettings-desktop-schemas"
"gnupg" "--" "sbcl"))
(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 ;; Faster, but not pure. TODO: Can we purify it? Run it in a container? Try `env -i bash --noprofile --norc...`.
;; TODO: Add easy way to reload: must delete profile. No need to delete dump if we use -f.
;; TODO: Extract to a separate function.
;; TODO: Extract to separate functions.
(lambda ()
;; TODO: Replace root when guix.scm is newer.
(let ((root (expand-file-name "~/.guix-temp-profiles/nyxt"))
(cache (expand-file-name "~/.cache/lisp-repl-core-nyxt"))
(setup-file (ambrevar/prepare-sbcl-for-nyxt)))
(unless (file-exists-p root)
(let* ((guix-def (expand-file-name "~/common-lisp/nyxt/build-scripts/guix.scm"))
(guix-def-mtime (file-attribute-modification-time (file-attributes guix-def)))
(root (expand-file-name "~/.guix-temp-profiles/nyxt"))
(root-mtime (file-attribute-modification-time (file-attributes root)))
(cache (expand-file-name "~/.cache/lisp-repl-core-nyxt"))
(setup-file (ambrevar/prepare-sbcl-for-nyxt)))
(unless (and (file-exists-p root)
(time-less-p guix-def-mtime root-mtime))
(make-directory (file-name-directory root) :parents)
(call-process "guix" nil nil nil
"environment" "--pure"
"--preserve=^PERSONAL$" ; To find personal config, like engines and bookmarks.
"-r" root
"-l" (expand-file-name "~/common-lisp/nyxt/build-scripts/guix.scm")
"-l" guix-def
"--ad-hoc" "glib" "glib-networking" "gsettings-desktop-schemas"
;; "nss-certs" ; Only needed in containers.
;; "libfixposix" ; TODO: We should not need this.
"gnupg"
"coreutils"
;; "libfixposix" ; TODO: We should not need this. Delete if there is no issue after a while (Jan 2021?).
"gnupg" ; For user .gpg decryption.
"coreutils" ; For "env".
"lisp-repl-core-dumper"
"--" "env" (concat "LISP_REPL_CORE_PATH=" cache)
"lisp-repl-core-dumper" "-f" "-g" (format "--load %s" setup-file) "sbcl")
"lisp-repl-core-dumper" "-f" "-g" (format "--load %s" setup-file) "sbcl")
(let ((delete-by-moving-to-trash nil))
(delete-file setup-file)))
`(("bash" "-c" ,(concat
(format "source '%s/etc/profile'" root)
" && LISP_REPL_CORE_PATH=" cache
" lisp-repl-core-dumper sbcl"))))))
;; Simple REPL environment (no container):
(sbcl-nyxt-failsafe ("guix" "environment" "--pure"
"--preserve=^PERSONAL$" ; To find personal config, like engines and bookmarks.
"-l" ,(expand-file-name "~/common-lisp/nyxt/build-scripts/guix.scm")
;; glib is needed to export GIO_EXTRA_MODULES.
"--ad-hoc" "glib" "glib-networking" "gsettings-desktop-schemas"
"gnupg" "--" "sbcl"))
(sbcl-nyxt-site ("guix" "environment" "--pure"
"-m" ,(expand-file-name "~/common-lisp/nyxt-site/guix-manifest.scm")
"--" "sbcl"))