about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-07T09·52+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-07T09·52+0100
commit9773bc32ee98ff3eea19fd55903c1d84c4ba17c1 (patch)
tree192120d6912e86a727b1c394628f2044e684b8c2
parent43fc1d93fb1151c9efafece3084cfdc6bf5e03e1 (diff)
Expose withEmacsPath on emacs attribute
I need this for Nix code that exists outside of this repository.
-rw-r--r--emacs/default.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/emacs/default.nix b/emacs/default.nix
index 685a37ec2b59..6c71ae0a6d4a 100644
--- a/emacs/default.nix
+++ b/emacs/default.nix
@@ -4,7 +4,7 @@ let
   inherit (builtins) path;
   inherit (depot.third_party) emacsPackagesGen emacs27;
   inherit (pkgs) writeShellScript writeShellScriptBin;
-  inherit (pkgs.lib.strings) makeBinPath;
+  inherit (pkgs.lib.strings) concatStringsSep makeBinPath;
 
   emacsBinPath = makeBinPath (with pkgs; [
     tdesktop
@@ -132,12 +132,19 @@ let
     name = "init.el";
   };
 
-  withEmacsPath = { emacsBin, briefcasePath }:
+  loadPath = concatStringsSep ":" [
+    wpcDir
+    vendorDir
+    # TODO: Explain why the trailing ":" is needed.
+    "${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
+  ];
+
+  withEmacsPath = { emacsBin, briefcasePath ? "$HOME/briefcase" }:
     writeShellScriptBin "wpcarros-emacs" ''
       export XMODIFIERS=emacs
       export BRIEFCASE=${briefcasePath}
       export PATH="${emacsBinPath}:$PATH"
-      export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
+      export EMACSLOADPATH="${loadPath}"
       exec ${emacsBin} \
         --debug-init \
         --no-site-file \
@@ -147,7 +154,7 @@ let
         "$@"
     '';
 in {
-  inherit initEl;
+  inherit initEl withEmacsPath;
 
   # I need to start my Emacs from CI without the call to `--load ${initEl}`.
   runScript = { script, briefcasePath }: