emacs: make trivialBuild know its elisp dependencies in another way
Previously, trivialBuild did not know how to find its elisp dependencies. This was[1] fixed[2] by basically rewriting part of package-activate-all in bash. I think it is better to call package-activate-all (or package-initialize if Emacs is old) directly. It reduces maintenance burden a bit. It also improves consistency since elpaBuild and melpaBuild already do so. This change provides almost the same functionality as before. It only breaks elisp packages with non-standard[^3] elisp dependencies. However, I think those non-standard ones should be fixed instead. As an example, mu4e used to be a non-standard one and was fixed[4]. This change does not cause more build failures in emacsPackages. [1]: https://github.com/NixOS/nixpkgs/pull/82604 [2]: https://github.com/NixOS/nixpkgs/commit/bf486f784ddd969c03243dba4c93d0e8e861173e [^3]: Non-standard elisp packages do not meet requirements of package.el, the builtin package manager of Emacs. Usually, they are installed to $out/share/emacs/site-lisp/$pname-$version and/or miss a $pname-pkg.el file. [4]: https://github.com/NixOS/nixpkgs/pull/253438
This commit is contained in:
@@ -20,15 +20,4 @@ addEmacsVars () {
|
||||
if [ -n "${addEmacsNativeLoadPath:-}" ]; then
|
||||
addToEmacsNativeLoadPath "$1/share/emacs/native-lisp"
|
||||
fi
|
||||
|
||||
# Add sub paths to the Emacs load path if it is a directory
|
||||
# containing .el files. This is necessary to build some packages,
|
||||
# e.g., using trivialBuild.
|
||||
for lispDir in \
|
||||
"$1/share/emacs/site-lisp/"* \
|
||||
"$1/share/emacs/site-lisp/elpa/"*; do
|
||||
if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
|
||||
addToEmacsLoadPath "$lispDir"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -86,10 +86,14 @@ libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs:
|
||||
source ${./emacs-funcs.sh}
|
||||
addEmacsVars "$out"
|
||||
|
||||
# package-activate-all is used to activate packages. In other builder
|
||||
# helpers, package-initialize is used for this purpose because
|
||||
# package-activate-all is not available before Emacs 27.
|
||||
find $out/share/emacs -type f -name '*.el' -not -name ".dir-locals.el" -print0 \
|
||||
| xargs --verbose -0 -I {} -n 1 -P $NIX_BUILD_CORES sh -c \
|
||||
"emacs \
|
||||
--batch \
|
||||
-f package-activate-all \
|
||||
--eval '(setq native-comp-eln-load-path (cdr native-comp-eln-load-path))' \
|
||||
--eval '(setq large-file-warning-threshold nil)' \
|
||||
--eval '(setq byte-compile-error-on-warn ${if finalAttrs.turnCompilationWarningToError then "t" else "nil"})' \
|
||||
|
||||
@@ -19,7 +19,7 @@ args:
|
||||
foundMakefile=1
|
||||
fi
|
||||
|
||||
emacs -L . --batch -f batch-byte-compile *.el
|
||||
emacs -l package -f package-initialize -L . --batch -f batch-byte-compile *.el
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user