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 + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c33dc33e6db7..9023d33704c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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;