summary refs log tree commit diff
path: root/pkgs/build-support/emacs
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-05 12:01:26 -0400
committerShea Levy <shea@shealevy.com>2016-09-05 12:01:26 -0400
commit05c132486d8cfae600bbfe8c9ac5d799b298afed (patch)
treeec39bfd46064507e3c7aed3ed2d5b6a052663138 /pkgs/build-support/emacs
parent8f023eb129f16a35970e8536df99188c43ca6d6d (diff)
downloadnixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar.gz
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar.bz2
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar.lz
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar.xz
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.tar.zst
nixpkgs-05c132486d8cfae600bbfe8c9ac5d799b298afed.zip
Initial version of nixBufferBuilders.withPackages.
This builds elisp to setup an emacs buffer with the packages given
available. See shlevy/nix-buffer for more information.

Currently only modifies $PATH.
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r--pkgs/build-support/emacs/buffer.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/build-support/emacs/buffer.nix b/pkgs/build-support/emacs/buffer.nix
new file mode 100644
index 00000000000..2f7f536d5e7
--- /dev/null
+++ b/pkgs/build-support/emacs/buffer.nix
@@ -0,0 +1,20 @@
+# Functions to build elisp files to locally configure emcas buffers.
+# See https://github.com/shlevy/nix-buffer
+
+{ runCommand }:
+
+{
+  withPackages = pkgs: runCommand "dir-locals.el" { inherit pkgs; } ''
+    echo        "(make-local-variable 'process-environment)" >> $out
+    echo        "(setenv \"PATH\" (concat" >> $out
+    for pkg in $pkgs; do
+      echo        "                \"$pkg/bin:$pkg/sbin\"" >> $out
+    done
+    echo          "                (getenv \"PATH\")))" >> $out
+    echo -n       "(setq-local exec-path (append '(" >> $out
+    for pkg in $pkgs; do
+      echo -en  "\n                                \"$pkg/bin\" \"$pkg/sbin\"" >> $out
+    done
+    echo -e   ")\\n                              exec-path))" >> $out
+  '';
+}