summary refs log tree commit diff stats
path: root/user/settings/emacs.nix
diff options
context:
space:
mode:
authorAlan Pearce2023-04-01 18:06:33 +0200
committerAlan Pearce2023-04-01 18:06:33 +0200
commit5c31e2ef01c78e4c3201fb0464891963f097ebeb (patch)
treeb613c6de8cd22f515cdc32574d899b9f8d02a584 /user/settings/emacs.nix
parent1b4e4f88abbbf1ed908ce511b36eb9769a8c0c41 (diff)
downloadnixfiles-5c31e2ef01c78e4c3201fb0464891963f097ebeb.tar.lz
nixfiles-5c31e2ef01c78e4c3201fb0464891963f097ebeb.tar.zst
nixfiles-5c31e2ef01c78e4c3201fb0464891963f097ebeb.zip
emacs: generate PATH at build time
Diffstat (limited to 'user/settings/emacs.nix')
-rw-r--r--user/settings/emacs.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/user/settings/emacs.nix b/user/settings/emacs.nix
index 51ce32ca..4ca2dbb5 100644
--- a/user/settings/emacs.nix
+++ b/user/settings/emacs.nix
@@ -6,6 +6,11 @@
 let
   inherit (pkgs) stdenv;
 
+  darwinPath = pkgs.runCommandLocal "path_helper " { } ''
+    eval $(/usr/libexec/path_helper -s)
+    echo -n $PATH > $out
+  '';
+
   editorScript = pkgs.writeScriptBin "edit" ''
     #!${pkgs.runtimeShell}
     if [ -z "$1" ]; then
@@ -151,6 +156,12 @@ in
         yaml-mode
         yasnippet
       ]);
+    extraConfig = ''
+      (with-eval-after-load 'editorconfig
+        (setq editorconfig-exec-path "${pkgs.editorconfig-core-c}/bin/editorconfig"))
+    '' + lib.optionalString stdenv.isDarwin ''
+      (setq exec-path (parse-colon-path (setenv "PATH" "${pkgs.lib.readFile darwinPath}")))
+    '';
   };
   home.packages = [
     editorScript