SLY: Make pure environment usable by preserving some more variables.

master
Pierre Neidhardt 2020-12-20 15:35:08 +01:00
parent 20719952ad
commit d36dec8fa4
1 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,17 @@
(require 'patch-sly)
(defun pure-env (&rest preserve-vars)
"Return a pure `env' command as a list of string."
(append '("env" "-i")
(mapcar (lambda (var) (concat var "=" (getenv var)))
(append
'("DISPLAY"
"HOME"
"LOGNAME"
"TERM"
"USER")
preserve-vars))))
(defun ambrevar/sbcl-for-nyxt (&optional refresh) ;; TODO: Run it in a container?
"Fast, pure Guix environment for Nyxt development.
If REFRESH is non-nil, rebuild the environment."
@ -25,7 +37,7 @@ If REFRESH is non-nil, rebuild the environment."
;; Update root mtime in case it's not changed.
;; Can't use `set-file-times' on links.
(call-process "touch" nil nil nil "-h" root))
`(("env" "-i" ,(concat "HOME=" (getenv "HOME")) ; HOME is needed for the ASDF cache.
`((,@(pure-env "PERSONAL")
,(executable-find "bash") "--norc" "--noprofile" "-c"
,(concat (format "source '%s/etc/profile'" root)
" && sbcl"))))))