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.
This commit is contained in:
Shea Levy 2016-09-05 12:01:26 -04:00
parent 8f023eb129
commit 05c132486d
2 changed files with 22 additions and 0 deletions

View file

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

View file

@ -285,6 +285,8 @@ in
inherit kernel rootModules allowMissing;
};
nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) runCommand; };
pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
srcOnly = args: callPackage ../build-support/src-only args;