summary refs log tree commit diff
path: root/pkgs/build-support/emacs
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-09-05 17:55:49 -0400
committerShea Levy <shea@shealevy.com>2016-09-05 17:55:49 -0400
commitb04cdae902398aa76fb81a0470e18fd527c6ba3d (patch)
treea4fef5e98d898c96ebcaceccb8d69ec8067f60dc /pkgs/build-support/emacs
parente8b15555247eff53d718ac7c13871e3ff4d3d8dc (diff)
downloadnixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar.gz
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar.bz2
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar.lz
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar.xz
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.tar.zst
nixpkgs-b04cdae902398aa76fb81a0470e18fd527c6ba3d.zip
nixBufferBuilders.withPackages: Make more legible, special-case proof-general.
There's some bigger changes coming, but thought I'd push this first...
Diffstat (limited to 'pkgs/build-support/emacs')
-rw-r--r--pkgs/build-support/emacs/buffer.nix31
1 files changed, 17 insertions, 14 deletions
diff --git a/pkgs/build-support/emacs/buffer.nix b/pkgs/build-support/emacs/buffer.nix
index 2f7f536d5e7..5632eae944c 100644
--- a/pkgs/build-support/emacs/buffer.nix
+++ b/pkgs/build-support/emacs/buffer.nix
@@ -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}
+    '';
 }