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:
parent
e8b1555524
commit
b04cdae902
@ -1,20 +1,23 @@
|
||||
# Functions to build elisp files to locally configure emcas buffers.
|
||||
# See https://github.com/shlevy/nix-buffer
|
||||
|
||||
{ runCommand }:
|
||||
{ lib, writeText }:
|
||||
|
||||
{
|
||||
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
|
||||
'';
|
||||
withPackages = pkgs: let
|
||||
coqs = builtins.filter (x: (builtins.parseDrvName x.name).name == "coq") pkgs;
|
||||
coq = builtins.head coqs;
|
||||
pg-setup = if builtins.length coqs == 0 then "" else ''
|
||||
(setq-local coq-prog-name "${coq}/bin/coqtop")
|
||||
(setq-local coq-dependency-analyzer "${coq}/bin/coqdep")
|
||||
(setq-local coq-compiler "${coq}/bin/coqc")
|
||||
(setq-local coq-library-directory (get-coq-library-directory))
|
||||
(coq-prog-args)
|
||||
'';
|
||||
in writeText "dir-locals.el" ''
|
||||
(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}
|
||||
'';
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ in
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user