1<section xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xml:id="sec-language-coq">
4
5<title>Coq</title>
6 <para>
7 Coq libraries should be installed in
8 <literal>$(out)/lib/coq/${coq.coq-version}/user-contrib/</literal>.
9 Such directories are automatically added to the
10 <literal>$COQPATH</literal> environment variable by the hook defined
11 in the Coq derivation.
12 </para>
13 <para>
14 Some libraries require OCaml and sometimes also Camlp5. The exact
15 versions that were used to build Coq are saved in the
16 <literal>coq.ocaml</literal> and <literal>coq.camlp5</literal>
17 attributes.
18 </para>
19 <para>
20 Here is a simple package example. It is a pure Coq library, thus it
21 only depends on Coq. Its <literal>makefile</literal> has been
22 generated using <literal>coq_makefile</literal> so we only have to
23 set the <literal>$COQLIB</literal> variable at install time.
24 </para>
25 <programlisting>
26{stdenv, fetchurl, coq}:
27stdenv.mkDerivation {
28 src = fetchurl {
29 url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
30 sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
31 };
32
33 name = "coq-karatsuba";
34
35 buildInputs = [ coq ];
36
37 installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
38}
39</programlisting>
40</section>
41