nixpkgs/pkgs/build-support/emacs/buffer.nix
Shea Levy 05c132486d 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.
2016-09-05 12:01:26 -04:00

21 lines
748 B
Nix

# 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
'';
}