Skip to content

Commit b21540c

Browse files
committedMay 20, 2017
coq: Add emacs buffer setup
1 parent b447f62 commit b21540c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed
 

‎pkgs/applications/science/logic/coq/default.nix

+15-4
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,27 @@ let
2626
substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp"
2727
substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true"
2828
'' else "";
29-
in
30-
31-
stdenv.mkDerivation {
29+
self = stdenv.mkDerivation {
3230
name = "coq-${version}";
3331

3432
inherit coq-version;
3533
inherit camlp5;
3634
inherit (ocamlPackages) ocaml;
3735
passthru = {
3836
inherit (ocamlPackages) findlib;
37+
emacsBufferSetup = pkgs: ''
38+
; Propagate coq paths to children
39+
(inherit-local-permanent coq-prog-name "${self}/bin/coqtop")
40+
(inherit-local-permanent coq-dependency-analyzer "${self}/bin/coqdep")
41+
(inherit-local-permanent coq-compiler "${self}/bin/coqc")
42+
; If the coq-library path was already set, re-set it based on our current coq
43+
(when (fboundp 'get-coq-library-directory)
44+
(inherit-local-permanent coq-library-directory (get-coq-library-directory))
45+
(coq-prog-args))
46+
(mapc (lambda (arg)
47+
(when (file-directory-p (concat arg "/lib/coq/${coq-version}/user-contrib"))
48+
(setenv "COQPATH" (concat (getenv "COQPATH") ":" arg "/lib/coq/${coq-version}/user-contrib")))) '(${stdenv.lib.concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
49+
'';
3950
};
4051

4152
src = fetchurl {
@@ -93,4 +104,4 @@ stdenv.mkDerivation {
93104
maintainers = with maintainers; [ roconnor thoughtpolice vbgl ];
94105
platforms = platforms.unix;
95106
};
96-
}
107+
}; in self

0 commit comments

Comments
 (0)
Please sign in to comment.