@@ -11,31 +11,53 @@
1111 in the Coq derivation.
1212 </para>
1313 <para>
14− Some libraries require OCaml and sometimes also Camlp5. The exact
15− versions that were used to build Coq are saved in the
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
1616 <literal>coq.ocaml</literal> and <literal>coq.camlp5</literal>
17− attributes.
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 <liberal>compatibleCoqVersions</liberal> attribute is used to
22+ precisely select those versions of Coq that are compatible with this
23+ derivation.
1824 </para>
1925 <para>
2026 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
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
2331 set the <literal>$COQLIB</literal> variable at install time.
2432 </para>
2533 <programlisting>
26−{stdenv, fetchurl, coq}:
27−stdenv.mkDerivation {
28− src = fetchurl {
29− url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
30− sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
31− };
34+{ stdenv, fetchFromGitHub, coq, mathcomp }:
3235
33− name = "coq-karatsuba";
36+stdenv.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+ };
3445
3546 buildInputs = [ coq ];
47+ propagatedBuildInputs = [ mathcomp ];
3648
3749 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+ };
3861}
3962</programlisting>
4063</section>
41−