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 or findlib. 15 The exact versions that were used to build Coq are saved in the 16 <literal>coq.ocaml</literal> and <literal>coq.camlp5</literal> 17 and <literal>coq.findlib</literal> attributes. 18 </para> 19 <para> 20 Coq libraries may be compatible with some specific versions of Coq only. 21 The <literal>compatibleCoqVersions</literal> attribute is used to 22 precisely select those versions of Coq that are compatible with this 23 derivation. 24 </para> 25 <para> 26 Here is a simple package example. It is a pure Coq library, thus it 27 depends on Coq. It builds on the Mathematical Components library, thus it 28 also takes <literal>mathcomp</literal> as <literal>buildInputs</literal>. 29 Its <literal>Makefile</literal> has been generated using 30 <literal>coq_makefile</literal> so we only have to 31 set the <literal>$COQLIB</literal> variable at install time. 32 </para> 33 <programlisting> 34{ stdenv, fetchFromGitHub, coq, mathcomp }: 35 36stdenv.mkDerivation rec { 37 name = "coq${coq.coq-version}-multinomials-${version}"; 38 version = "1.0"; 39 src = fetchFromGitHub { 40 owner = "math-comp"; 41 repo = "multinomials"; 42 rev = version; 43 sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m"; 44 }; 45 46 buildInputs = [ coq ]; 47 propagatedBuildInputs = [ mathcomp ]; 48 49 installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; 50 51 meta = { 52 description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials"; 53 inherit (src.meta) homepage; 54 license = stdenv.lib.licenses.cecill-b; 55 inherit (coq.meta) platforms; 56 }; 57 58 passthru = { 59 compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ]; 60 }; 61} 62</programlisting> 63</section>