2015-12-19 15:04:36 +00:00
|
|
|
<section xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xml:id="sec-language-coq">
|
|
|
|
|
|
|
|
<title>Coq</title>
|
|
|
|
<para>
|
|
|
|
Coq libraries should be installed in
|
|
|
|
<literal>$(out)/lib/coq/${coq.coq-version}/user-contrib/</literal>.
|
|
|
|
Such directories are automatically added to the
|
|
|
|
<literal>$COQPATH</literal> environment variable by the hook defined
|
|
|
|
in the Coq derivation.
|
|
|
|
</para>
|
|
|
|
<para>
|
2017-12-18 01:28:08 +00:00
|
|
|
Some libraries require OCaml and sometimes also Camlp5 or findlib.
|
|
|
|
The exact versions that were used to build Coq are saved in the
|
2015-12-19 15:04:36 +00:00
|
|
|
<literal>coq.ocaml</literal> and <literal>coq.camlp5</literal>
|
2017-12-18 01:28:08 +00:00
|
|
|
and <literal>coq.findlib</literal> attributes.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Coq libraries may be compatible with some specific versions of Coq only.
|
2017-12-19 10:34:54 +00:00
|
|
|
The <literal>compatibleCoqVersions</literal> attribute is used to
|
2017-12-18 01:28:08 +00:00
|
|
|
precisely select those versions of Coq that are compatible with this
|
|
|
|
derivation.
|
2015-12-19 15:04:36 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Here is a simple package example. It is a pure Coq library, thus it
|
2017-12-18 01:28:08 +00:00
|
|
|
depends on Coq. It builds on the Mathematical Components library, thus it
|
|
|
|
also takes <literal>mathcomp</literal> as <literal>buildInputs</literal>.
|
|
|
|
Its <literal>Makefile</literal> has been generated using
|
|
|
|
<literal>coq_makefile</literal> so we only have to
|
2015-12-19 15:04:36 +00:00
|
|
|
set the <literal>$COQLIB</literal> variable at install time.
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
2017-12-18 01:28:08 +00:00
|
|
|
{ stdenv, fetchFromGitHub, coq, mathcomp }:
|
2015-12-19 15:04:36 +00:00
|
|
|
|
2017-12-18 01:28:08 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "coq${coq.coq-version}-multinomials-${version}";
|
|
|
|
version = "1.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "math-comp";
|
|
|
|
repo = "multinomials";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
|
|
|
|
};
|
2015-12-19 15:04:36 +00:00
|
|
|
|
|
|
|
buildInputs = [ coq ];
|
2017-12-18 01:28:08 +00:00
|
|
|
propagatedBuildInputs = [ mathcomp ];
|
2015-12-19 15:04:36 +00:00
|
|
|
|
|
|
|
installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
|
2017-12-18 01:28:08 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
|
|
|
|
inherit (src.meta) homepage;
|
|
|
|
license = stdenv.lib.licenses.cecill-b;
|
|
|
|
inherit (coq.meta) platforms;
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ];
|
|
|
|
};
|
2015-12-19 15:04:36 +00:00
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</section>
|