fix(lib): package!: add :env property

Allows the association of arbitrary envvars or variables with the build
artifacts of a package. If they change, the package is rebuilt on the
next 'doom sync'. This is a temporary measure, which is why this is not
touted as a new feature. It will be replaced in v3.
This commit is contained in:
Henrik Lissner
2025-09-22 22:30:30 -04:00
parent 1bc2af6ce5
commit 87a7efcea6
3 changed files with 41 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ Can be changed externally by setting $DOOMPROFILELOADFILE.")
;;; Profile storage variables
(defvar doom-profile-generators
'(("05-vars.auto.el" doom-profile--generate-vars doom--startup-vars)
("20-package-envs.auto.el" doom-profile--generate-package-envs)
("80-loaddefs.auto.el" doom-profile--generate-loaddefs-doom doom--startup-loaddefs-doom)
("90-loaddefs-packages.auto.el" doom-profile--generate-loaddefs-packages doom--startup-loaddefs-packages)
("95-modules.auto.el" doom-profile--generate-load-modules doom--startup-modules))
@@ -422,6 +423,16 @@ caches them in `doom--profiles'. If RELOAD? is non-nil, refresh the cache."
(mapcan #'doom-glob doom-autoloads-files))
nil)))))
(defun doom-profile--generate-package-envs ()
(cl-loop for (_ . plist) in doom-packages
if (plist-get plist :env)
append (cl-loop for (var . val) in it
if (and (stringp var) val)
collect `(setenv ,var ,val)
else if (and (symbolp var)
(string-prefix-p "_" (symbol-name var)))
collect `(setq-default ,var ,val))))
(defun doom-profile--generate-loaddefs-packages ()
`((defun doom--startup-loaddefs-packages ()
(let ((load-in-progress t))