diff options
author | Shea Levy <shea@shealevy.com> | 2016-09-05 12:01:26 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2016-09-05 12:01:26 -0400 |
commit | 05c132486d8cfae600bbfe8c9ac5d799b298afed (patch) | |
tree | ec39bfd46064507e3c7aed3ed2d5b6a052663138 /pkgs/build-support/emacs | |
parent | 8f023eb129f16a35970e8536df99188c43ca6d6d (diff) |
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.nix | 20 |
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 000000000000..2f7f536d5e75 --- /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 + ''; +} |