Merge pull request #54 from league/nix-elisp-bundle

Support specifying a nix-generated elisp package bundle
This commit is contained in:
Arne Brasseur 2023-01-16 16:19:04 +01:00 committed by GitHub
commit aeaf83452d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -140,6 +140,14 @@ Other things you can configure
visible to any subprocesses spawned from Emacs.
- =straight-p= Enable the [[https://github.com/raxod502/straight.el][Straight]]
functional package manager.
- =nix-elisp-bundle= A directory containing elisp dependencies bundled by the
nix package manager. The bundle path can be produced by nix using an
expression like =(emacs.pkgs.withPackages (p: [ p.avy … ])).deps=.
Because the bundle path is in the nix store, if it is specified
in =.emacs-profiles.el= then that file should also be maintained by
nix, to prevent the path from being garbage-collected.
Alternatively, a nix-generated script or alias could specify
=nix-elisp-bundle= as a command-line argument.
Store =.emacs-profiles.el= together with your dotfiles. If you're not yet keeping
a version controlled directory of dotfiles, then check out

View file

@ -142,6 +142,23 @@ selected profile (if any)."
(setenv (car env) (cdr env)))
(chemacs-profile-get 'env))
;; Insinuate a nix elisp dependency bundle, if specified. In Emacs 27, the
;; startup.el looks through the load-path for any directory named site-lisp with
;; a subdirectory named elpa. If found, it activates them as packages. Starting
;; in Emacs 28, it instead relies on package-directory-list. It seems we can
;; distinguish these by whether package-directory-list is already bound in
;; early-init.
(let ((dir (chemacs-profile-get 'nix-elisp-bundle)))
(when dir
(if (boundp 'package-directory-list)
(add-to-list 'package-directory-list
(expand-file-name "share/emacs/site-lisp/elpa" dir))
(add-to-list 'load-path
(expand-file-name "share/emacs/site-lisp" dir)))
(when (boundp 'native-comp-eln-load-path)
(add-to-list 'native-comp-eln-load-path
(expand-file-name "share/emacs/native-lisp/" dir)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun chemacs-load-user-early-init ()