about summary refs log tree commit diff
path: root/emacs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/default.nix')
-rw-r--r--emacs/default.nix60
1 files changed, 34 insertions, 26 deletions
diff --git a/emacs/default.nix b/emacs/default.nix
index 126894a8fc3a..439f66396734 100644
--- a/emacs/default.nix
+++ b/emacs/default.nix
@@ -134,40 +134,48 @@ let
     name = "init.el";
   };
 
-  withEmacsPath = emacsBin: pkgs.writeShellScriptBin "wpcarros-emacs" ''
-    export XMODIFIERS=emacs
-    export BRIEFCASE=$HOME/briefcase
-    export PATH="${emacsBinPath}:$PATH"
-    export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
-    exec ${emacsBin} \
-      --debug-init \
-      --no-site-file \
-      --no-site-lisp \
-      --load ${initEl} \
-      --no-init-file \
-      "$@"
-  '';
+  withEmacsPath = { emacsBin, briefcasePath }:
+    pkgs.writeShellScriptBin "wpcarros-emacs" ''
+      export XMODIFIERS=emacs
+      export BRIEFCASE=${briefcasePath}
+      export PATH="${emacsBinPath}:$PATH"
+      export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
+      exec ${emacsBin} \
+        --debug-init \
+        --no-site-file \
+        --no-site-lisp \
+        --load ${initEl} \
+        --no-init-file \
+        "$@"
+    '';
 in {
   inherit initEl;
 
   # I need to start my Emacs from CI without the call to `--load ${initEl}`.
-  runScript = script: pkgs.writeShellScript "run-emacs-script" ''
-    export BRIEFCASE=$HOME/briefcase
-    export PATH="${emacsBinPath}:$PATH"
-    export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
-    exec ${wpcarrosEmacs}/bin/emacs \
-      --no-site-file \
-      --no-site-lisp \
-      --no-init-file \
-      --script ${script} \
-      "$@"
-  '';
+  runScript = { script, briefcasePath }:
+    pkgs.writeShellScript "run-emacs-script" ''
+      export BRIEFCASE=${briefcasePath}
+      export PATH="${emacsBinPath}:$PATH"
+      export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
+      exec ${wpcarrosEmacs}/bin/emacs \
+        --no-site-file \
+        --no-site-lisp \
+        --no-init-file \
+        --script ${script} \
+        "$@"
+    '';
 
   # Use `nix-env -f '<briefcase>' emacs.glinux` to install `wpcarro-emacs` on
   # gLinux machines. This will ensure that X and GL linkage behaves as expected.
-  glinux = withEmacsPath "/usr/bin/google-emacs";
+  glinux = { briefcasePath ? "$HOME/briefcase" }: withEmacsPath {
+    inherit briefcasePath;
+    emacsBin = "/usr/bin/google-emacs";
+  };
 
   # Use `nix-env -f '<briefcase>' emacs.nixos` to install `wpcarros-emacs` on
   # NixOS machines.
-  nixos = withEmacsPath "${wpcarrosEmacs}/bin/emacs";
+  nixos = { briefcasePath ? "$HOME/briefcase" }: withEmacsPath {
+    inherit briefcasePath;
+    emacsBin = "${wpcarrosEmacs}/bin/emacs";
+  };
 }