diff --git a/pkgs/development/coq-modules/mathcomp/1.5.nix b/pkgs/development/coq-modules/mathcomp/1.5.nix deleted file mode 100644 index c984bab49171..000000000000 --- a/pkgs/development/coq-modules/mathcomp/1.5.nix +++ /dev/null @@ -1,26 +0,0 @@ -{stdenv, fetchurl, coq, ssreflect}: - -stdenv.mkDerivation { - - name = "coq-mathcomp-1.5-8.5b2"; - - src = fetchurl { - url = http://ssr.msr-inria.inria.fr/FTP/mathcomp-1.5.coq85beta2.tar.gz; - sha256 = "03bnq44ym43x8shi7whc02l0g5vy6rx8f1imjw478chlgwcxazqy"; - }; - - propagatedBuildInputs = [ coq ssreflect ]; - - enableParallelBuilding = true; - - installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; - - meta = with stdenv.lib; { - homepage = http://ssr.msr-inria.inria.fr/; - license = licenses.cecill-b; - maintainers = [ maintainers.vbgl maintainers.jwiegley ]; - platforms = coq.meta.platforms; - hydraPlatforms = []; - }; - -} diff --git a/pkgs/development/coq-modules/mathcomp/default.nix b/pkgs/development/coq-modules/mathcomp/default.nix index 02d06edd538b..7c34e186717c 100644 --- a/pkgs/development/coq-modules/mathcomp/default.nix +++ b/pkgs/development/coq-modules/mathcomp/default.nix @@ -1,26 +1,24 @@ -{stdenv, fetchurl, coq, ssreflect}: +{ callPackage, coq, fetchurl }: -stdenv.mkDerivation { +let src = + if coq.coq-version == "8.4" then - name = "coq-mathcomp-1.5"; + fetchurl { + url = http://ssr.msr-inria.inria.fr/FTP/mathcomp-1.5.tar.gz; + sha256 = "1297svwi18blrlyd8vsqilar2h5nfixlvlifdkbx47aljq4m5bam"; + } - src = fetchurl { - url = http://ssr.msr-inria.inria.fr/FTP/mathcomp-1.5.tar.gz; - sha256 = "1297svwi18blrlyd8vsqilar2h5nfixlvlifdkbx47aljq4m5bam"; - }; + else if coq.coq-version == "8.5" then - propagatedBuildInputs = [ coq ssreflect ]; + fetchurl { + url = http://ssr.msr-inria.inria.fr/FTP/mathcomp-1.5.coq85beta2.tar.gz; + sha256 = "03bnq44ym43x8shi7whc02l0g5vy6rx8f1imjw478chlgwcxazqy"; + } - enableParallelBuilding = true; + else throw "No mathcomp package for Coq version ${coq.coq-version}"; - installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; - - meta = with stdenv.lib; { - homepage = http://ssr.msr-inria.inria.fr/; - license = licenses.cecill-b; - maintainers = [ maintainers.vbgl maintainers.jwiegley ]; - platforms = coq.meta.platforms; - hydraPlatforms = []; - }; +in +callPackage ./generic.nix { + inherit src; } diff --git a/pkgs/development/coq-modules/mathcomp/generic.nix b/pkgs/development/coq-modules/mathcomp/generic.nix new file mode 100644 index 000000000000..56838734b6d3 --- /dev/null +++ b/pkgs/development/coq-modules/mathcomp/generic.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchurl, coq, ssreflect +, graphviz, ocamlPackages, withDoc ? true +, src +}: + +stdenv.mkDerivation { + + name = "coq-mathcomp-1.5-${coq.coq-version}"; + + inherit src; + + nativeBuildInputs = stdenv.lib.optionals withDoc + ([ graphviz ] ++ (with ocamlPackages; [ ocaml camlp5_transitional ])); + propagatedBuildInputs = [ ssreflect ]; + + enableParallelBuilding = true; + + buildFlags = stdenv.lib.optionalString withDoc "doc"; + + installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; + + postInstall = stdenv.lib.optionalString withDoc '' + make -f Makefile.coq install-doc DOCDIR=$out/share/coq/${coq.coq-version}/ + ''; + + meta = with stdenv.lib; { + homepage = http://ssr.msr-inria.inria.fr/; + license = licenses.cecill-b; + maintainers = [ maintainers.vbgl maintainers.jwiegley ]; + platforms = coq.meta.platforms; + }; + +} diff --git a/pkgs/development/coq-modules/ssreflect/default.nix b/pkgs/development/coq-modules/ssreflect/default.nix index 75112ec96639..a0b0d951c0df 100644 --- a/pkgs/development/coq-modules/ssreflect/default.nix +++ b/pkgs/development/coq-modules/ssreflect/default.nix @@ -1,40 +1,27 @@ -{stdenv, fetchurl, coq}: +{ callPackage, fetchurl, coq }: -assert coq.coq-version == "8.4"; +if coq.coq-version == "8.4" then -stdenv.mkDerivation { - - name = "coq-ssreflect-1.5"; +callPackage ./generic.nix { src = fetchurl { url = http://ssr.msr-inria.inria.fr/FTP/ssreflect-1.5.tar.gz; sha256 = "0hm1ha7sxqfqhc7iwhx6zdz3nki4rj5nfd3ab24hmz8v7mlpinds"; }; - buildInputs = [ coq.ocaml coq.camlp5 ]; - propagatedBuildInputs = [ coq ]; +} - enableParallelBuilding = true; +else if coq.coq-version == "8.5" then - patchPhase = '' - # Permit building of the ssrcoq statically-bound executable - sed -i 's/^#-custom/-custom/' Make - sed -i 's/^#SSRCOQ/SSRCOQ/' Make - ''; +callPackage ./generic.nix { - installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; - - postInstall = '' - mkdir -p $out/bin - cp -p bin/ssrcoq $out/bin - cp -p bin/ssrcoq.byte $out/bin - ''; - - meta = with stdenv.lib; { - homepage = http://ssr.msr-inria.inria.fr/; - license = licenses.cecill-b; - maintainers = with maintainers; [ vbgl jwiegley ]; - platforms = coq.meta.platforms; + src = fetchurl { + url = http://ssr.msr-inria.inria.fr/FTP/ssreflect-1.5.coq85beta2.tar.gz; + sha256 = "084l9xd5vgb8jml0dkm66g8cil5rsf04w821pjhn2qk9mdbwaagf"; }; + patches = [ ./threads.patch ]; + } + +else throw "No ssreflect package for Coq version ${coq.coq-version}" diff --git a/pkgs/development/coq-modules/ssreflect/1.5.nix b/pkgs/development/coq-modules/ssreflect/generic.nix similarity index 59% rename from pkgs/development/coq-modules/ssreflect/1.5.nix rename to pkgs/development/coq-modules/ssreflect/generic.nix index 7c16b43ba8cb..e208f1cc25a8 100644 --- a/pkgs/development/coq-modules/ssreflect/1.5.nix +++ b/pkgs/development/coq-modules/ssreflect/generic.nix @@ -1,22 +1,21 @@ -{stdenv, fetchurl, coq}: - -assert coq.coq-version == "8.5"; +{ stdenv, fetchurl, coq +, graphviz, withDoc ? true +, src, patches ? [] +}: stdenv.mkDerivation { - name = "coq-ssreflect-1.5-8.5b2"; + name = "coq-ssreflect-1.5-${coq.coq-version}"; - src = fetchurl { - url = http://ssr.msr-inria.inria.fr/FTP/ssreflect-1.5.coq85beta2.tar.gz; - sha256 = "084l9xd5vgb8jml0dkm66g8cil5rsf04w821pjhn2qk9mdbwaagf"; - }; + inherit src; + nativeBuildInputs = stdenv.lib.optionals withDoc [ graphviz ]; buildInputs = [ coq.ocaml coq.camlp5 ]; propagatedBuildInputs = [ coq ]; enableParallelBuilding = true; - patches = [ ./threads.patch ]; + inherit patches; postPatch = '' # Permit building of the ssrcoq statically-bound executable @@ -24,12 +23,17 @@ stdenv.mkDerivation { sed -i 's/^#SSRCOQ/SSRCOQ/' Make ''; + buildFlags = stdenv.lib.optionalString withDoc "doc"; + installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; postInstall = '' mkdir -p $out/bin cp -p bin/ssrcoq $out/bin cp -p bin/ssrcoq.byte $out/bin + '' + stdenv.lib.optionalString withDoc '' + mkdir -p $out/share/doc/coq/${coq.coq-version}/user-contrib/Ssreflect/ + cp -r html $out/share/doc/coq/${coq.coq-version}/user-contrib/Ssreflect/ ''; meta = with stdenv.lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bc4a490902da..0959b25fad51 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14048,6 +14048,8 @@ let mkCoqPackages_8_4 = self: let callPackage = newScope self; in { + inherit callPackage; + bedrock = callPackage ../development/coq-modules/bedrock {}; contribs = @@ -14090,19 +14092,18 @@ let mkCoqPackages_8_5 = self: let callPackage = newScope self; in rec { - mathcomp = callPackage ../development/coq-modules/mathcomp/1.5.nix { - coq = coq_8_5; - ssreflect = ssreflect; - }; + inherit callPackage; - ssreflect = callPackage ../development/coq-modules/ssreflect/1.5.nix { - coq = coq_8_5; - }; + coq = coq_8_5; + + mathcomp = callPackage ../development/coq-modules/mathcomp { }; + + ssreflect = callPackage ../development/coq-modules/ssreflect { }; }; coqPackages = recurseIntoAttrs (mkCoqPackages_8_4 coqPackages); - coqPackages_8_5 = recurseIntoAttrs (mkCoqPackages_8_5 coqPackages); + coqPackages_8_5 = recurseIntoAttrs (mkCoqPackages_8_5 coqPackages_8_5); cvc3 = callPackage ../applications/science/logic/cvc3 {}; cvc4 = callPackage ../applications/science/logic/cvc4 {};