summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-04-25 23:12:51 +0200
committerAlan Pearce2023-04-25 23:14:09 +0200
commitc2c5e04d53ba91e22cf43ac42a54fb0606fb9465 (patch)
tree1b2ea43ba2cff70982147ed208e7a9ec18c44857 /user
parent9389e4954b12c12b2f020236bd6642f238ec8c9b (diff)
downloadnixfiles-c2c5e04d53ba91e22cf43ac42a54fb0606fb9465.tar.lz
nixfiles-c2c5e04d53ba91e22cf43ac42a54fb0606fb9465.tar.zst
nixfiles-c2c5e04d53ba91e22cf43ac42a54fb0606fb9465.zip
emacs: native-compile init.el ahead of time
Diffstat (limited to 'user')
-rw-r--r--user/settings/emacs.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/user/settings/emacs.nix b/user/settings/emacs.nix
index 755b8b95..9c9f9660 100644
--- a/user/settings/emacs.nix
+++ b/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 @@ in
         (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 @@ in
   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
     '';
   };