summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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
     '';
   };