about summary refs log tree commit diff
path: root/pkgs/applications/science/logic
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2017-05-20 08:34:33 -0400
committerShea Levy <shea@shealevy.com>2017-05-20 08:34:33 -0400
commitb21540c4a668ebe34e1868c21e7dd8cc653fdabd (patch)
tree8866d257190a15257b7e2a6698dc5882f313aa70 /pkgs/applications/science/logic
parentb447f624c35660db50cd8202563557b089efad38 (diff)
downloadnixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar.gz
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar.bz2
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar.lz
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar.xz
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.tar.zst
nixlib-b21540c4a668ebe34e1868c21e7dd8cc653fdabd.zip
coq: Add emacs buffer setup
Diffstat (limited to 'pkgs/applications/science/logic')
-rw-r--r--pkgs/applications/science/logic/coq/default.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix
index bc9ba049cd2c..9faa9d8feb8a 100644
--- a/pkgs/applications/science/logic/coq/default.nix
+++ b/pkgs/applications/science/logic/coq/default.nix
@@ -26,9 +26,7 @@ let
     substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp"
     substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true"
   '' else "";
-in
-
-stdenv.mkDerivation {
+self = stdenv.mkDerivation {
   name = "coq-${version}";
 
   inherit coq-version;
@@ -36,6 +34,19 @@ stdenv.mkDerivation {
   inherit (ocamlPackages) ocaml;
   passthru = {
     inherit (ocamlPackages) findlib;
+    emacsBufferSetup = pkgs: ''
+      ; Propagate coq paths to children
+      (inherit-local-permanent coq-prog-name "${self}/bin/coqtop")
+      (inherit-local-permanent coq-dependency-analyzer "${self}/bin/coqdep")
+      (inherit-local-permanent coq-compiler "${self}/bin/coqc")
+      ; If the coq-library path was already set, re-set it based on our current coq
+      (when (fboundp 'get-coq-library-directory)
+        (inherit-local-permanent coq-library-directory (get-coq-library-directory))
+        (coq-prog-args))
+      (mapc (lambda (arg)
+        (when (file-directory-p (concat arg "/lib/coq/${coq-version}/user-contrib"))
+          (setenv "COQPATH" (concat (getenv "COQPATH") ":" arg "/lib/coq/${coq-version}/user-contrib")))) '(${stdenv.lib.concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
+    '';
   };
 
   src = fetchurl {
@@ -93,4 +104,4 @@ stdenv.mkDerivation {
     maintainers = with maintainers; [ roconnor thoughtpolice vbgl ];
     platforms = platforms.unix;
   };
-}
+}; in self