3
0
Fork 0
forked from mirrors/nixpkgs

nixBufferBuilders.withPackages: Make more legible, special-case proof-general.

There's some bigger changes coming, but thought I'd push this first...
This commit is contained in:
Shea Levy 2016-09-05 17:55:49 -04:00
parent e8b1555524
commit b04cdae902
2 changed files with 18 additions and 15 deletions

View file

@ -1,20 +1,23 @@
# Functions to build elisp files to locally configure emcas buffers. # Functions to build elisp files to locally configure emcas buffers.
# See https://github.com/shlevy/nix-buffer # See https://github.com/shlevy/nix-buffer
{ runCommand }: { lib, writeText }:
{ {
withPackages = pkgs: runCommand "dir-locals.el" { inherit pkgs; } '' withPackages = pkgs: let
echo "(make-local-variable 'process-environment)" >> $out coqs = builtins.filter (x: (builtins.parseDrvName x.name).name == "coq") pkgs;
echo "(setenv \"PATH\" (concat" >> $out coq = builtins.head coqs;
for pkg in $pkgs; do pg-setup = if builtins.length coqs == 0 then "" else ''
echo " \"$pkg/bin:$pkg/sbin\"" >> $out (setq-local coq-prog-name "${coq}/bin/coqtop")
done (setq-local coq-dependency-analyzer "${coq}/bin/coqdep")
echo " (getenv \"PATH\")))" >> $out (setq-local coq-compiler "${coq}/bin/coqc")
echo -n "(setq-local exec-path (append '(" >> $out (setq-local coq-library-directory (get-coq-library-directory))
for pkg in $pkgs; do (coq-prog-args)
echo -en "\n \"$pkg/bin\" \"$pkg/sbin\"" >> $out '';
done in writeText "dir-locals.el" ''
echo -e ")\\n exec-path))" >> $out (make-local-variable 'process-environment)
(setenv "PATH" (concat "${lib.makeSearchPath "bin" pkgs}:" (getenv "PATH")))
(setq-local exec-path (append '(${builtins.concatStringsSep " " (map (p: "\"${p}/bin\"") pkgs)}) exec-path))
${pg-setup}
''; '';
} }

View file

@ -285,7 +285,7 @@ in
inherit kernel rootModules allowMissing; inherit kernel rootModules allowMissing;
}; };
nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) runCommand; }; nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; };
pathsFromGraph = ../build-support/kernel/paths-from-graph.pl; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;