emacs: native-compile init.el ahead of time
Alan Pearce alan@alanpearce.eu
Tue, 25 Apr 2023 23:12:51 +0200
1 files changed, 7 insertions(+), 3 deletions(-)
jump to
M user/settings/emacs.nix → user/settings/emacs.nix
@@ -6,6 +6,8 @@ }: let inherit (pkgs) stdenv; + nativeCompileDirectory = "${config.xdg.cacheHome}/emacs/native-compile/"; + darwinPath = pkgs.runCommandLocal "path_helper " { } '' eval $(/usr/libexec/path_helper) echo -n $PATH > $out @@ -165,7 +167,9 @@ (with-eval-after-load 'files (setq insert-directory-program "${pkgs.coreutils-prefixed}/bin/gls")) (with-eval-after-load 'dired (setq dired-use-ls-dired t)) - (setq exec-path (parse-colon-path (setenv "PATH" "${pkgs.clang}/bin:${pkgs.gcc}/bin:${pkgs.lib.readFile darwinPath}"))) + (setq exec-path (parse-colon-path (setenv "PATH" "${pkgs.lib.readFile darwinPath}")) + native-compile-target-directory "${nativeCompileDirectory}") + (add-to-list 'native-comp-eln-load-path "${nativeCompileDirectory}" :append) ''; }; home.packages = [ @@ -174,13 +178,13 @@ ]; xdg.configFile."emacs/early-init.el" = { source = ../emacs/early-init.el; onChange = '' - ${config.programs.emacs.finalPackage}/bin/emacs -Q -batch -f batch-byte-compile .config/emacs/early-init.el + PATH="$PATH:/usr/libexec/DeveloperTools/" ${config.programs.emacs.finalPackage}/bin/emacs --batch --funcall batch-native-compile .config/emacs/early-init.el ''; }; xdg.configFile."emacs/init.el" = { source = ../emacs/init.el; onChange = '' - ${config.programs.emacs.finalPackage}/bin/emacs -Q -batch -f batch-byte-compile .config/emacs/init.el + PATH="$PATH:/usr/libexec/DeveloperTools/" ${config.programs.emacs.finalPackage}/bin/emacs --batch --funcall batch-native-compile .config/emacs/init.el ''; };