-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emacs: Add nativeComp packaging infrastructure #104010
Conversation
f3c3ae6
to
b61a0d6
Compare
59ec0de
to
531c740
Compare
531c740
to
fe572df
Compare
fe572df
to
a7cb8e3
Compare
emacs#44726 is done, it seems |
@tadfisher I've implemented the changes related to emacs#44726 and rebased this PR on @alyssais's latest correctness fixes re |
A protip for future readers: |
Would either of you be interested in implementing similar for the home-manager emacs infrastructure? No problem if not, just that I've just realised this doesn't apply to me because I use that instead. |
@bqv home-manager doesn't have emacs packaging infrastructure. |
Whoops, I guess I misundertood what was happening here. It doesn't apply to me because I don't use emacsWithPackages, not otherwise. Sorry! |
A protip for future readers:
If you want to use Nix as your only emacs package manager I recommend
setting `(setq comp-deferred-compilation nil)` to avoid native
compilation kicking in at runtime.
Should we make emacsWithPackages set this by default? I'd assume that
most people using it for one package use it for all of their packages,
or at least almost all.
|
There's a caveat to this which might be worth mentioning. The files you get in ~/.emacs.d/eln-cache if you don't do this really weren't native-compiled by Nix, so you will not get speedups for such files if you disable deferred compilation (which is a valid choice if you don't want to deal with ~/.emacs.d/eln-cache clutter). The most common cause for this (after #107777 is merged, at least) is if a dependency is missing from the Lisp package's Nix derivation, or if a native package such as mu does not native-compile its elisp files. Such cases are rare, and in my case (which includes mu4e) deferred compilation at first startup takes less than 10 seconds. |
Motivation for this change
Ref: nix-community/emacs-overlay#74
This is the start of some infrastructure to package native-compilation outputs for Emacs with
nativeComp
enabled.I've tried to mimic the existing
site-lisp
pattern as much as possible:$out/share/emacs/native-lisp
.comp-eln-load-path
from$profileDir/share/emacs/native-lisp
insite-start.el
.EMACSNATIVELOADPATH
env variable to mimicEMACSLOADPATH
. As upstream does not support a variable like this, add some code tosite-start.el
to populatecomp-eln-load-path
from it.emacsWithPackages
to linknative-lisp
along withsite-lisp
for included elisp packages.This is a draft because:
comp
because they are hashed by both their content and their absolute file path. There is some code incomp.c
that ignores the path part of the hash if it's located inlispdirrel
, so perhaps there's a way to rename these files correctly to match whatcomp
expects for a "system" load path..eln
files are loaded from the Nix store now when usingemacsWithPackages
.EMACSNATIVELOADPATH
so we don't have to have the workaround insite-start.el
. I've filed #44726 to request this.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)