summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Cohen <CohenCyril@users.noreply.github.com>2020-05-09 07:47:47 +0200
committerGitHub <noreply@github.com>2020-05-09 07:47:47 +0200
commit8d05e53561678e67dc51c4d52270a0d0cd8761fc (patch)
treec97f1f1640842507d76eec125ed07bc249c6cc03
parent0c0f353d62188ba676a2396ed3be4fcfdd88d632 (diff)
Coq: refactoring of mathcomp packages (#86088)
- fixed bignum version - fixed coq-bits version - fixed coqprime version - fixed mathcomp and mathcomp extra packages (reworked building scheme and removed unused ssreflect directory) - giving the user access to function filterCoqPackages, because overrideScope' does not re-apply it.
-rw-r--r--pkgs/development/coq-modules/bignums/default.nix4
-rw-r--r--pkgs/development/coq-modules/coq-bits/default.nix6
-rw-r--r--pkgs/development/coq-modules/coqprime/default.nix44
-rw-r--r--pkgs/development/coq-modules/mathcomp/default.nix345
-rw-r--r--pkgs/development/coq-modules/mathcomp/extra.nix539
-rw-r--r--pkgs/development/coq-modules/ssreflect/default.nix32
-rw-r--r--pkgs/top-level/coq-packages.nix47
7 files changed, 609 insertions, 408 deletions
diff --git a/pkgs/development/coq-modules/bignums/default.nix b/pkgs/development/coq-modules/bignums/default.nix
index d61d5968ea03..0e8cead0b31e 100644
--- a/pkgs/development/coq-modules/bignums/default.nix
+++ b/pkgs/development/coq-modules/bignums/default.nix
@@ -18,8 +18,8 @@ let params = {
sha256 = "03qz1w2xb2j5p06liz5yyafl0fl9vprcqm6j0iwi7rxwghl00p01";
};
"8.10" = {
- rev = "V8.10+beta1";
- sha256 = "1slw227idwjw9a21vj3s6kal22mrmvvlpg8r7xk590ml99bn6404";
+ rev = "V8.10.0";
+ sha256 = "0bpb4flckn4nqxbs3wjiznyx1k7r8k93qdigp3qwmikp2lxvcbw5";
};
"8.11" = {
rev = "V8.11.0";
diff --git a/pkgs/development/coq-modules/coq-bits/default.nix b/pkgs/development/coq-modules/coq-bits/default.nix
index 97fd23208f2f..05dcb7898e50 100644
--- a/pkgs/development/coq-modules/coq-bits/default.nix
+++ b/pkgs/development/coq-modules/coq-bits/default.nix
@@ -9,9 +9,9 @@ stdenv.mkDerivation {
src = fetchFromGitHub {
owner = "coq-community";
- repo = "coq-bits";
- rev = "f74498a6c67e97d9565e139d62be8eaae7111f06";
- sha256 = "1ibg37qxgkmpbpvc78qcb179bcnzl149z1kzwdm8n98xk5ibavrf";
+ repo = "bits";
+ rev = "1.0.0";
+ sha256 = "0nv5mdgrd075dpd8bc7h0xc5i95v0pkm0bfyq5rj6ii1s54dwcjl";
};
buildInputs = [ coq ];
diff --git a/pkgs/development/coq-modules/coqprime/default.nix b/pkgs/development/coq-modules/coqprime/default.nix
index aaf867baf258..a049fa94d415 100644
--- a/pkgs/development/coq-modules/coqprime/default.nix
+++ b/pkgs/development/coq-modules/coqprime/default.nix
@@ -1,22 +1,26 @@
-{ stdenv, fetchFromGitHub, coq, bignums }:
-
-let params =
- let v_8_8 = {
- version = "8.8";
- sha256 = "075yjczk79pf1hd3lgdjiz84ilkzfxjh18lgzrhhqp7d3kz5lxp5";
- };
- in
- {
- "8.7" = {
- version = "8.7.2";
- sha256 = "15zlcrx06qqxjy3nhh22wzy0rb4npc8l4nx2bbsfsvrisbq1qb7k";
- };
- "8.8" = v_8_8;
- "8.9" = v_8_8;
- "8.10" = v_8_8;
- };
- param = params.${coq.coq-version}
-; in
+{ stdenv, which, fetchFromGitHub, coq, bignums }:
+
+let
+ params =
+ let v_8_8 = {
+ version = "8.8";
+ sha256 = "075yjczk79pf1hd3lgdjiz84ilkzfxjh18lgzrhhqp7d3kz5lxp5";
+ };
+ in
+ {
+ "8.7" = {
+ version = "8.7.2";
+ sha256 = "15zlcrx06qqxjy3nhh22wzy0rb4npc8l4nx2bbsfsvrisbq1qb7k";
+ };
+ "8.8" = v_8_8;
+ "8.9" = v_8_8;
+ "8.10" = {
+ version = "8.10";
+ sha256 = "0r9gnh5a5ykiiz5h1i8xnzgiydpwc4z9qhndxyya85xq0f910qaz";
+ };
+ };
+ param = params.${coq.coq-version};
+in
stdenv.mkDerivation rec {
@@ -30,7 +34,7 @@ stdenv.mkDerivation rec {
inherit (param) sha256;
};
- buildInputs = [ coq ];
+ buildInputs = [ which coq ];
propagatedBuildInputs = [ bignums ];
diff --git a/pkgs/development/coq-modules/mathcomp/default.nix b/pkgs/development/coq-modules/mathcomp/default.nix
index aeb53a995e55..140bf8ab5364 100644
--- a/pkgs/development/coq-modules/mathcomp/default.nix
+++ b/pkgs/development/coq-modules/mathcomp/default.nix
@@ -1,97 +1,151 @@
-{ stdenv, fetchFromGitHub, ncurses, which, graphviz, coq,
- recurseIntoAttrs, withDoc ? false
+#############################
+# Main derivation: mathcomp #
+########################################################################
+# This file mainly provides the `mathcomp` derivation, which is #
+# essentially a meta-package containing all core mathcomp libraries #
+# (ssreflect fingroup algebra solvable field character). They can be #
+# accessed individually through the paththrough attributes of mathcomp #
+# bearing the same names (mathcomp.ssreflect, etc). #
+# #
+# Do not use overrideAttrs, but overrideMathcomp instead, which #
+# regenerate a full mathcomp derivation with sub-derivations, and #
+# behave the same as `mathcomp_`, described below. #
+########################################################################
+
+############################################################
+# Compiling a custom version of mathcomp using `mathcomp_` #
+##############################################################################
+# The prefered way to compile a custom version of mathcomp (other than a #
+# released version which should be added to `mathcomp-config-initial` #
+# and pushed to nixpkgs), is to apply the function `coqPackages.mathcomp_` #
+# to either: #
+# - a string without slash, which is interpreted as a github revision, #
+# i.e. either a tag, a branch or a commit hash #
+# - a string with slashes "owner/p_1/.../p_n", which is interpreted as #
+# github owner "owner" and revision "p_1/.../p_n". #
+# - a path which is interpreted as a local source for the repository, #
+# the name of the version is taken to be the basename of the path #
+# i.e. if the path is /home/you/git/package/branch/, #
+# then "branch" is the name of the version #
+# - an attribute set which overrides some attributes (e.g. the src) #
+# if the version is updated, the name is automatically regenerated using #
+# the conventional schema "coq${coq.coq-version}-${pkgname}-${version}" #
+# - a "standard" override function (old: new_attrs) to override the default #
+# attribute set, so that you can use old.${field} to patch the derivation. #
+##############################################################################
+
+#########################################################################
+# Example of use: https://github.com/math-comp/math-comp/wiki/Using-nix #
+#########################################################################
+
+#################################
+# Adding a new mathcomp version #
+#############################################################################
+# When adding a new version of mathcomp, add an attribute to `sha256` (use #
+# ```sh #
+# nix-prefetch-url --unpack #
+# https://github.com/math-comp/math-comp/archive/version.tar.gz #
+# ``` #
+# to get the corresponding `sha256`) and to `coq-version` (read the release #
+# notes to check which versions of coq it is compatible with). Then add #
+# it in `preference version`, if not all mathcomp-extra packages are #
+# ready, you might want to give new release secondary priority. #
+#############################################################################
+
+
+{ stdenv, fetchFromGitHub, ncurses, which, graphviz,
+ recurseIntoAttrs, withDoc ? false,
+ coqPackages,
+ mathcomp_, mathcomp, mathcomp-config,
}:
with builtins // stdenv.lib;
let
- ####################################
- # CONFIGURATION (please edit this) #
- ####################################
- # sha256 of released mathcomp versions
- mathcomp-sha256 = {
- "1.10.0" = "1b9m6pwxxyivw7rgx82gn5kmgv2mfv3h3y0mmjcjfypi8ydkrlbv";
- "1.9.0" = "0lid9zaazdi3d38l8042lczb02pw5m9wq0yysiilx891hgq2p81r";
- "1.8.0" = "07l40is389ih8bi525gpqs3qp4yb2kl11r9c8ynk1ifpjzpnabwp";
- "1.7.0" = "0wnhj9nqpx2bw6n1l4i8jgrw3pjajvckvj3lr4vzjb3my2lbxdd1";
- "1.6.1" = "1ilw6vm4dlsdv9cd7kmf0vfrh2kkzr45wrqr8m37miy0byzr4p9i";
- };
- # versions of coq compatible with released mathcomp versions
- mathcomp-coq-versions = {
- "1.10.0" = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" ];
- "1.9.0" = flip elem ["8.7" "8.8" "8.9" "8.10"];
- "1.8.0" = flip elem ["8.7" "8.8" "8.9"];
- "1.7.0" = flip elem ["8.6" "8.7" "8.8" "8.9"];
- "1.6.1" = flip elem ["8.5"];
+ mathcomp-config-initial = rec {
+ #######################################################################
+ # CONFIGURATION (please edit this), it is exported as mathcomp-config #
+ #######################################################################
+ # sha256 of released mathcomp versions
+ sha256 = {
+ "1.11.0+beta1" = "12i3zznwajlihzpqsiqniv20rklj8d8401lhd241xy4s21fxkkjm";
+ "1.10.0" = "1b9m6pwxxyivw7rgx82gn5kmgv2mfv3h3y0mmjcjfypi8ydkrlbv";
+ "1.9.0" = "0lid9zaazdi3d38l8042lczb02pw5m9wq0yysiilx891hgq2p81r";
+ "1.8.0" = "07l40is389ih8bi525gpqs3qp4yb2kl11r9c8ynk1ifpjzpnabwp";
+ "1.7.0" = "0wnhj9nqpx2bw6n1l4i8jgrw3pjajvckvj3lr4vzjb3my2lbxdd1";
+ "1.6.1" = "1ilw6vm4dlsdv9cd7kmf0vfrh2kkzr45wrqr8m37miy0byzr4p9i";
+ };
+ # versions of coq compatible with released mathcomp versions
+ coq-versions = {
+ "1.11.0+beta1" = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" ];
+ "1.10.0" = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" ];
+ "1.9.0" = flip elem [ "8.7" "8.8" "8.9" "8.10" ];
+ "1.8.0" = flip elem [ "8.7" "8.8" "8.9" ];
+ "1.7.0" = flip elem [ "8.6" "8.7" "8.8" "8.9" ];
+ "1.6.1" = flip elem [ "8.5"];
+ };
+
+ # sets the default version of mathcomp given a version of Coq
+ # this is currently computed using version-perference below
+ # but it can be set to a fixed version number
+ preferred-version = let v = head (
+ filter (mc: mathcomp-config.coq-versions.${mc} coq.coq-version)
+ mathcomp-config.version-preferences ++ ["0.0.0"]);
+ in if v == "0.0.0" then head mathcomp-config.version-preferences else v;
+
+ # mathcomp preferred versions by decreasing order
+ # (the first version in the list will be tried first)
+ version-preferences =
+ [ "1.10.0" "1.9.0" "1.11.0+beta1" "1.8.0" "1.7.0" "1.6.1" ];
+
+ # list of core mathcomp packages sorted by dependency order
+ packages = _version: # unused in current versions of mathcomp
+ # because the following list of packages is fixed for
+ # all versions of mathcomp up to 1.11.0
+ [ "ssreflect" "fingroup" "algebra" "solvable" "field" "character" "all" ];
+
+ # compute the dependencies of the core package pkg
+ # (assuming the total ordering above, change if necessary)
+ deps = version: pkg: if pkg == "single" then [] else
+ (pred-split-list (x: x == pkg) (mathcomp-config.packages version)).left;
};
- # computes the default version of mathcomp given a version of Coq
- max-mathcomp-version = last (naturalSort (attrNames mathcomp-coq-versions));
- # mathcomp prefered version by decreasing order
- # (the first version in the list will be tried first)
- mathcomp-version-preference = [ "1.8.0" "1.9.0" "1.10.0" "1.7.0" "1.6.1" ];
##############################################################
# COMPUTED using the configuration above (edit with caution) #
##############################################################
- default-mathcomp-version = let v = head (
- filter (mc: mathcomp-coq-versions.${mc} coq.coq-version)
- mathcomp-version-preference ++ ["0.0.0"]);
- in if v == "0.0.0" then max-mathcomp-version else v;
-
- # list of core mathcomp packages sorted by dependency order
- mathcomp-packages =
- [ "ssreflect" "fingroup" "algebra" "solvable" "field" "character" "all" ];
- # compute the dependencies of the core package pkg
- # (assuming the total ordering above, rewrite if necessary)
- mathcomp-deps = pkg: if pkg == "single" then [] else
- (split (x: x == pkg) mathcomp-packages).left;
# generic split function (TODO: move to lib?)
- split = pred: l:
+ pred-split-list = pred: l:
let loop = v: l: if l == [] then {left = v; right = [];}
else let hd = builtins.head l; tl = builtins.tail l; in
if pred hd then {left = v; right = tl;} else loop (v ++ [hd]) tl;
in loop [] l;
- # exported, documented at the end.
- mathcompGen = mkMathcompGenFrom (_: {}) mathcomp-packages;
+ pkgUp = l: r: l // r // {
+ meta = (l.meta or {}) // (r.meta or {});
+ passthru = (l.passthru or {}) // (r.passthru or {});
+ };
- # exported, documented at the end.
- mathcompGenSingle = mkMathcompGen (_: {}) "single";
+ coq = coqPackages.coq;
+ mathcomp-deps = mathcomp-config.deps mathcomp.config.preferred-version;
- # mkMathcompGen: internal mathcomp package generator
- # returns {error = ...} if impossible to generate
- # returns {${mathcomp-pkg} = <derivation>} otherwise
- mkMathcompGenFrom = o: l: mcv: fold (pkg: pkgs: pkgs // mkMathcompGen o pkg mcv) {} l;
- mkMathcompGen = overrides: mathcomp-pkg: mathcomp-version:
+ # default set of attributes given a 'package' name.
+ # this attribute set will be extended using toOverrideFun
+ default-attrs = package:
let
- coq-version-check = mathcomp-coq-versions.${mathcomp-version} or (_: false);
- pkgpath = {single = "mathcomp";}.${mathcomp-pkg} or "mathcomp/${mathcomp-pkg}";
- pkgname = {single = "mathcomp";}.${mathcomp-pkg} or "mathcomp-${mathcomp-pkg}";
+ pkgpath = if package == "single" then "mathcomp" else "mathcomp/${package}";
+ pkgname = if package == "single" then "mathcomp" else "mathcomp-${package}";
pkgallMake = ''
- echo "all.v" > Make
- echo "-I ." >> Make
- echo "-R . mathcomp.all" >> Make
+ echo "all.v" > Make
+ echo "-I ." >> Make
+ echo "-R . mathcomp.all" >> Make
'';
- is-released = builtins.isString mathcomp-version;
- custom-version = if is-released then mathcomp-version else "custom";
-
- # the base set of attributes for mathcomp
- attrs = {
- name = "coq${coq.coq-version}-${pkgname}-${custom-version}";
-
- # used in ssreflect
- version = custom-version;
-
- src = if is-released then fetchFromGitHub {
- owner = "math-comp";
- repo = "math-comp";
- rev = "mathcomp-${mathcomp-version}";
- sha256 = mathcomp-sha256.${mathcomp-version};
- } else mathcomp-version;
+ in
+ rec {
+ version = "master";
+ name = "coq${coq.coq-version}-${pkgname}-${version}";
nativeBuildInputs = optionals withDoc [ graphviz ];
buildInputs = [ ncurses which ] ++ (with coq.ocamlPackages; [ ocaml findlib camlp5 ]);
- propagatedBuildInputs = [ coq ] ++
- attrValues (mkMathcompGenFrom overrides (mathcomp-deps mathcomp-pkg) mathcomp-version);
+ propagatedBuildInputs = [ coq ];
enableParallelBuilding = true;
buildFlags = optional withDoc "doc";
@@ -101,7 +155,7 @@ let
preBuild = ''
patchShebangs etc/utils/ssrcoqdep || true
cd ${pkgpath}
- '' + optionalString (mathcomp-pkg == "all") pkgallMake;
+ '' + optionalString (package == "all") pkgallMake;
installPhase = ''
make -f Makefile.coq COQLIB=$out/lib/coq/${coq.coq-version}/ install
@@ -110,67 +164,98 @@ let
'';
meta = with stdenv.lib; {
- homepage = "https://math-comp.github.io/";
- license = licenses.cecill-b;
- maintainers = [ maintainers.vbgl maintainers.jwiegley ];
- platforms = coq.meta.platforms;
+ homepage = "https://math-comp.github.io/";
+ license = licenses.cecill-b;
+ maintainers = [ maintainers.vbgl maintainers.jwiegley maintainers.cohencyril ];
+ platforms = coq.meta.platforms;
};
passthru = {
- compatibleCoqVersions = coq-version-check;
- currentOverrides = overrides;
- overrideMathcomp = moreOverrides:
- (mkMathcompGen (old: let new = overrides old; in new // moreOverrides new)
- mathcomp-pkg mathcomp-version).${mathcomp-pkg};
- mathcompGen = moreOverrides:
- (mkMathcompGenFrom (old: let new = overrides old; in new // moreOverrides new)
- mathcomp-packages mathcomp-version);
+ mathcompDeps = mathcomp-deps package;
+ inherit package mathcomp-config;
+ compatibleCoqVersions = _: true;
};
};
+
+ # converts a string, path or attribute set into an override function
+ toOverrideFun = overrides:
+ if isFunction overrides then overrides else old:
+ let
+ pkgname = if old.passthru.package == "single" then "mathcomp"
+ else "mathcomp-${old.passthru.package}";
+
+ string-attrs = if hasAttr overrides mathcomp-config.sha256 then
+ let version = overrides;
+ in {
+ inherit version;
+ src = fetchFromGitHub {
+ owner = "math-comp";
+ repo = "math-comp";
+ rev = "mathcomp-${version}";
+ sha256 = mathcomp-config.sha256.${version};
+ };
+ passthru = old.passthru // {
+ compatibleCoqVersions = mathcomp-config.coq-versions.${version};
+ mathcompDeps = mathcomp-config.deps version old.passthru.package;
+ };
+ }
+ else
+ let splitted = filter isString (split "/" overrides);
+ owner = head splitted;
+ ref = concatStringsSep "/" (tail splitted);
+ version = head (reverseList splitted);
+ in if length splitted == 1 then {
+ inherit version;
+ src = fetchTarball "https://github.com/math-comp/math-comp/archive/${version}.tar.gz";
+ } else {
+ inherit version;
+ src = fetchTarball "https://github.com/${owner}/math-comp/archive/${ref}.tar.gz";
+ };
+
+ attrs =
+ if overrides == null || overrides == "" then _: {}
+ else if isString overrides then string-attrs
+ else if isPath overrides then { version = baseNameOf overrides; src = overrides; }
+ else if isAttrs overrides then pkgUp old overrides
+ else let overridesStr = toString overrides; in
+ abort "${overridesStr} not a legitimate overrides";
+ in
+ attrs // (if attrs?version && ! (attrs?name)
+ then { name = "coq${coq.coq-version}-${pkgname}-${attrs.version}"; } else {});
+
+ # generates {ssreflect = «derivation ...» ; ... ; character = «derivation ...», ...}
+ mkMathcompGenSet = pkgs: o:
+ fold (pkg: pkgs: pkgs // {${pkg} = mkMathcompGen pkg o;}) {} pkgs;
+ # generates the derivation of one mathcomp package.
+ mkMathcompGen = package: overrides:
+ let
+ up = x: o: x // (toOverrideFun o x);
+ fixdeps = attrs:
+ let version = attrs.version or "master";
+ mcdeps = if package == "single" then {}
+ else mkMathcompGenSet (filter isString attrs.passthru.mathcompDeps) overrides;
+ allmc = mkMathcompGenSet (mathcomp-config.packages version ++ [ "single" ]) overrides;
+ in {
+ propagatedBuildInputs = [ coq ]
+ ++ filter isDerivation attrs.passthru.mathcompDeps
+ ++ attrValues mcdeps
+ ;
+ passthru = allmc //
+ { overrideMathcomp = o: mathcomp_ (old: up (up old overrides) o); };
+ };
in
- {${mathcomp-pkg} = stdenv.mkDerivation (attrs // overrides attrs);};
-
-getAttrOr = a: n: a.${n} or (throw a.error);
-
-mathcompCorePkgs_1_7 = mathcompGen "1.7.0";
-mathcompCorePkgs_1_8 = mathcompGen "1.8.0";
-mathcompCorePkgs_1_9 = mathcompGen "1.9.0";
-mathcompCorePkgs_1_10 = mathcompGen "1.10.0";
-mathcompCorePkgs = recurseIntoAttrs
- (mapDerivationAttrset dontDistribute (mathcompGen default-mathcomp-version));
-
-in {
-# mathcompGenSingle: given a version of mathcomp
-# generates an attribute set {single = <drv>;} with the single mathcomp derivation
-inherit mathcompGenSingle;
-mathcomp_1_7_single = getAttrOr (mathcompGenSingle "1.7.0") "single";
-mathcomp_1_8_single = getAttrOr (mathcompGenSingle "1.8.0") "single";
-mathcomp_1_9_single = getAttrOr (mathcompGenSingle "1.9.0") "single";
-mathcomp_1_10_single = getAttrOr (mathcompGenSingle "1.10.0") "single";
-mathcomp_single = dontDistribute
- (getAttrOr (mathcompGenSingle default-mathcomp-version) "single");
-
-# mathcompGen: given a version of mathcomp
-# generates an attribute set {ssreflect = <drv>; ... character = <drv>; all = <drv>;}.
-# each of these have a special attribute overrideMathcomp which
-# must be used instead of overrideAttrs in order to also fix the dependencies
-inherit mathcompGen mathcompCorePkgs
- mathcompCorePkgs_1_7 mathcompCorePkgs_1_8 mathcompCorePkgs_1_9
- mathcompCorePkgs_1_10
- ;
-
-
-mathcomp = getAttrOr mathcompCorePkgs "all";
-mathcomp_1_7 = getAttrOr mathcompCorePkgs_1_7 "all";
-mathcomp_1_8 = getAttrOr mathcompCorePkgs_1_8 "all";
-mathcomp_1_9 = getAttrOr mathcompCorePkgs_1_9 "all";
-mathcomp_1_10 = getAttrOr mathcompCorePkgs_1_10 "all";
-
-ssreflect = getAttrOr mathcompCorePkgs "ssreflect";
-
-} //
-(mapAttrs' (n: pkg: {name = "mathcomp-${n}"; value = pkg;}) mathcompCorePkgs) //
-(mapAttrs' (n: pkg: {name = "mathcomp-${n}_1_7"; value = pkg;}) mathcompCorePkgs_1_7) //
-(mapAttrs' (n: pkg: {name = "mathcomp-${n}_1_8"; value = pkg;}) mathcompCorePkgs_1_8) //
-(mapAttrs' (n: pkg: {name = "mathcomp-${n}_1_9"; value = pkg;}) mathcompCorePkgs_1_9) //
-(mapAttrs' (n: pkg: {name = "mathcomp-${n}_1_10"; value = pkg;}) mathcompCorePkgs_1_10)
+ stdenv.mkDerivation (up (up (default-attrs package) overrides) fixdeps);
+in
+{
+ mathcomp-config = mathcomp-config-initial;
+ mathcomp_ = mkMathcompGen "all";
+ mathcomp = mathcomp_ mathcomp-config.preferred-version;
+ # mathcomp-single = mathcomp.single;
+ ssreflect = mathcomp.ssreflect;
+ mathcomp-ssreflect = mathcomp.ssreflect;
+ mathcomp-fingroup = mathcomp.fingroup;
+ mathcomp-algebra = mathcomp.algebra;
+ mathcomp-solvable = mathcomp.solvable;
+ mathcomp-field = mathcomp.field;
+ mathcomp-character = mathcomp.character;
+}
diff --git a/pkgs/development/coq-modules/mathcomp/extra.nix b/pkgs/development/coq-modules/mathcomp/extra.nix
index 2df9cbe58c72..d37608658b4f 100644
--- a/pkgs/development/coq-modules/mathcomp/extra.nix
+++ b/pkgs/development/coq-modules/mathcomp/extra.nix
@@ -1,202 +1,371 @@
-{ stdenv, fetchFromGitHub, coq, ssreflect, coqPackages,
- recurseIntoAttrs }:
+##########################################################
+# Main derivation: #
+# mathcomp-finmap mathcomp-analysis mathcomp-bigenough #
+# mathcomp-multinomials mathcomp-real-closed coqeal #
+# Additionally: #
+# mathcomp-extra-all contains all the extra packages #
+# mathcomp-extra-fast contains the one not marked slow #
+########################################################################
+# This file mainly provides the above derivations, which are packages #
+# extra mathcomp libraries based on mathcomp. #
+########################################################################
+
+#####################################################
+# Compiling customs versions using `mathcomp-extra` #
+##############################################################################
+# The prefered way to compile a custom version of mathcomp extra packages #
+# (other than released versions which should be added to #
+# `rec-mathcomp-extra-config` and pushed to nixpkgs, see below), #
+# is to use `coqPackages.mathcomp-extra name version` where #
+# 1. `name` is a string representing the name of a declared package #
+# OR undeclared package. #
+# 2. `version` is either: #
+# - a string without slash, which is interpreted as a github revision, #
+# i.e. either a tag, a branch or a commit hash #
+# - a string with slashes "owner/p_1/.../p_n", which is interpreted as #
+# github owner "owner" and revision "p_1/.../p_n". #
+# - a path which is interpreted as a local source for the repository, #
+# the name of the version is taken to be the basename of the path #
+# i.e. if the path is /home/you/git/package/branch/, #
+# then "branch" is the name of the version #
+# - an attribute set which overrides some attributes (e.g. the src) #
+# if the version is updated, the name is automatically regenerated using #
+# the conventional schema "coq${coq.coq-version}-${pkgname}-${version}" #
+# - a "standard" override function (old: new_attrs) to override the default #
+# attribute set, so that you can use old.${field} to patch the derivation. #
+# #
+# Should you choose to use `pkg.overrideAttrs` instead, we provide the #
+# function mathcomp-extra-override which takes a name and a version exactly #
+# as above and returns an override function. #
+##############################################################################
+
+#########################################################################
+# Example of use: https://github.com/math-comp/math-comp/wiki/Using-nix #
+#########################################################################
+
+###########################################
+# Adding a new package or package version #
+################################################################################
+# 1. Update or add a `package` entry to `initial`, it must be a function #
+# taking the version as argument and returning an attribute set. Everything #
+# is optional and the default for the sources of the repository and the #
+# homepage will be https://github.com/math-comp/${package}. #
+# #
+# 2. Update or add a `package` entry to `sha256` for each release. #
+# You may use #
+# ```sh #
+# nix-prefetch-url --unpack #
+# https://github.com/math-comp/math-comp/archive/version.tar.gz #
+# ``` #
+# #
+# 3. Update or create a new consistent set of extra packages. #
+# /!\ They must all be co-compatible. /!\ #
+# Do not use versions that may disappear: it must either be #
+# - a tag from the main repository (e.g. version or tag), or #
+# - a revision hash that has been *merged in master* #
+################################################################################
+
+{ stdenv, fetchFromGitHub, recurseIntoAttrs,
+ which, mathcomp, coqPackages,
+ mathcomp-extra-config, mathcomp-extra-override,
+ mathcomp-extra, current-mathcomp-extra,
+}:
with builtins // stdenv.lib;
-let current-ssreflect = ssreflect; in
let
-# configuring packages
-param = {
- finmap = {
- version-sha256 = {
- "1.2.1" = "0jryb5dq8js3imbmwrxignlk5zh8gwfb1wr4b1s7jbwz410vp7zf";
- "1.2.0" = "0b6wrdr0d7rcnv86s37zm80540jl2wmiyf39ih7mw3dlwli2cyj4";
- "1.1.0" = "05df59v3na8jhpsfp7hq3niam6asgcaipg2wngnzxzqnl86srp2a";
- "1.0.0" = "0sah7k9qm8sw17cgd02f0x84hki8vj8kdz7h15i7rmz08rj0whpa";
- };
- description = "A finset and finmap library";
- };
- bigenough = {
- version-sha256 = {"1.0.0" = "10g0gp3hk7wri7lijkrqna263346wwf6a3hbd4qr9gn8hmsx70wg";};
- description = "A small library to do epsilon - N reasonning";
- };
- multinomials = {
- version-sha256 = {
- "1.3" = "0l3vi5n094nx3qmy66hsv867fnqm196r8v605kpk24gl0aa57wh4";
- "1.2" = "1mh1w339dslgv4f810xr1b8v2w7rpx6fgk9pz96q0fyq49fw2xcq";
- "1.1" = "1q8alsm89wkc0lhcvxlyn0pd8rbl2nnxg81zyrabpz610qqjqc3s";
- "1.0" = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
- };
- description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
- };
- analysis = {
- version-sha256 = {
- "0.2.2" = "1d5dwg9di2ppdzfg21zr0a691zigb5kz0lcw263jpyli1nrq7cvk";
- "0.2.0" = "1186xjxgns4ns1szyi931964bjm0mp126qzlv10mkqqgfw07nhrd";
- "0.1.0" = "0hwkr2wzy710pcyh274fcarzdx8sv8myp16pv0vq5978nmih46al";
- };
- compatibleCoqVersions = flip elem ["8.8" "8.9"];
- description = "Analysis library compatible with Mathematical Components";
- license = stdenv.lib.licenses.cecill-c;
- };
- real-closed = {
- version-sha256 = {
- "1.0.3" = "1xbzkzqgw5p42dx1liy6wy8lzdk39zwd6j14fwvv5735k660z7yb";
- "1.0.2" = "0097pafwlmzd0gyfs31bxpi1ih04i72nxhn99r93aj20mn7mcsgl";
- "1.0.1" = "0j81gkjbza5vg89v4n9z598mfdbql416963rj4b8fzm7dp2r4rxg";
- };
- description = "Mathematical Components Library on real closed fields";
- };
- coqeal = {
- version-sha256 = {
- "1.0.0" = "1had6f1n85lmh9x31avbmgl3m0rsiw9f8ma95qzk5b57fjg5k1ii";
- };
- description = "CoqEAL - The Coq Effective Algebra Library";
- owner = "CoqEAL";
- compatibleCoqVersions = flip elem ["8.7" "8.8" "8.9"];
- license = stdenv.lib.licenses.mit;
- };
-};
-versions = {
- "1.9.0" = {
- finmap.version = "1.2.1";
- bigenough.version = "1.0.0";
- analysis = {
- version = "0.2.2";
- core-deps = with coqPackages; [ mathcomp-field_1_9 ];
- extra-deps = with coqPackages; [ mathcomp_1_9-finmap mathcomp_1_9-bigenough ];
- };
- multinomials = {
- version = "1.3";
- core-deps = with coqPackages; [ mathcomp-algebra_1_9 ];
- extra-deps = with coqPackages; [ mathcomp_1_9-finmap mathcomp_1_9-bigenough ];
- };
- real-closed = {
- version = "1.0.3";
- core-deps = with coqPackages; [ mathcomp-field_1_9 ];
- extra-deps = with coqPackages; [ mathcomp_1_9-bigenough ];
- };
- };
- "1.8.0" = {
- finmap.version = "1.2.1";
- bigenough.version = "1.0.0";
- analysis = {
- version = "0.2.2";
- core-deps = with coqPackages; [ mathcomp-field_1_8 ];
- extra-deps = with coqPackages; [ mathcomp_1_8-finmap mathcomp_1_8-bigenough ];
- };
- multinomials = {
- version = "1.3";
- core-deps = with coqPackages; [ mathcomp-algebra_1_8 ];
- extra-deps = with coqPackages; [ mathcomp_1_8-finmap mathcomp_1_8-bigenough ];
- };
- real-closed = {
- version = "1.0.3";
- core-deps = with coqPackages; [ mathcomp-field_1_8 ];
- extra-deps = with coqPackages; [ mathcomp_1_8-bigenough ];
- };
- coqeal = {
- version = "1.0.0";
- core-deps = with coqPackages; [ mathcomp-algebra_1_8 ];
- extra-deps = with coqPackages; [ bignums paramcoq mathcomp_1_8-multinomials ];
- };
- };
- "1.7.0" = {
- finmap.version = "1.1.0";
- bigenough.version = "1.0.0";
- analysis = {
- version = "0.1.0";
- core-deps = with coqPackages; [ mathcomp-field_1_7 ];
- extra-deps = with coqPackages; [ mathcomp_1_7-finmap mathcomp_1_7-bigenough ];
- };
- multinomials = {
- version = "1.1";
- core-deps = with coqPackages; [ mathcomp-algebra_1_7 ];
- extra-deps = with coqPackages; [ mathcomp_1_7-finmap_1_0 mathcomp_1_7-bigenough ];
- };
- real-closed = {
- version = "1.0.1";
- core-deps = with coqPackages; [ mathcomp-field_1_7 ];
- extra-deps = with coqPackages; [ mathcomp_1_7-bigenough ];
- };
- };
-};
-
-# generic package generator
-packageGen = {
- # optional arguments
- src ? "",
- owner ? "math-comp",
- extra-deps ? [],
- ssreflect ? current-ssreflect,
- core-deps ? null,
- compatibleCoqVersions ? null,
- license ? ssreflect.meta.license,
- # mandatory
- package, version ? "broken", version-sha256, description
- }:
- let
- theCompatibleCoqVersions = if compatibleCoqVersions == null
- then ssreflect.compatibleCoqVersions
- else compatibleCoqVersions;
- mc-core-deps = if builtins.isNull core-deps then [ssreflect] else core-deps;
- in
- { ${package} = let from = src; in
+ ##############################
+ # CONFIGURATION, please edit #
+ ##############################
+ ############################
+ # Packages base delaration #
+ ############################
+ rec-mathcomp-extra-config = {
+ initial = {
+ mathcomp-finmap = version: {
+ meta = {
+ description = "A finset and finmap library";
+ repo = "finmap";
+ homepage = "https://github.com/math-comp/finmap";
+ };
+ passthru.compatibleCoqVersions = flip elem [ "8.8" "8.9" "8.10" "8.11" ];
+ };
- stdenv.mkDerivation rec {
- inherit version;
- name = "coq${coq.coq-version}-mathcomp${ssreflect.version}-${package}-${version}";
+ mathcomp-bigenough = version: {
+ meta = {
+ description = "A small library to do epsilon - N reasonning";
+ repo = "bigenough";
+ homepage = "https://github.com/math-comp/bigenough";
+ };
+ passthru.compatibleCoqVersions = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" ];
+ };
- src = if from == "" then fetchFromGitHub {
- owner = owner;
- repo = package;
- rev = version;
- sha256 = version-sha256.${version};
- } else from;
+ multinomials = version: {
+ buildInputs = [ which ];
+ propagatedBuildInputs = with coqPackages;
+ [ mathcomp.algebra mathcomp-finmap mathcomp-bigenough ];
+ meta = {
+ description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
+ repo = "multinomials";
+ homepage = "https://github.com/math-comp/multinomials";
+ };
+ passthru.compatibleCoqVersions = flip elem [ "8.9" "8.10" "8.11" ];
+ };
- propagatedBuildInputs = [ coq ] ++ mc-core-deps ++ extra-deps;
+ mathcomp-analysis = version: {
+ propagatedBuildInputs = with coqPackages;
+ [ mathcomp.field mathcomp-finmap mathcomp-bigenough ];
+ meta = {
+ description = "Analysis library compatible with Mathematical Components";
+ homepage = "https://github.com/math-comp/analysis";
+ repo = "analysis";
+ license = stdenv.lib.licenses.cecill-c;
+ };
+ passthru.compatibleCoqVersions = flip elem ["8.8" "8.9" "8.10" "8.11" ];
+ };
- installFlags = [ "-f" "Makefile.coq" "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
+ mathcomp-real-closed = version: {
+ propagatedBuildInputs = with coqPackages;
+ [ coq mathcomp.field mathcomp-bigenough ];
+ meta = {
+ description = "Mathematical Components Library on real closed fields";
+ repo = "real-closed";
+ homepage = "https://github.com/math-comp/real-closed";
+ };
+ passthru.compatibleCoqVersions = flip elem ["8.8" "8.9" "8.10" "8.11" ];
+ };
- meta = {
- inherit description;
- inherit license;
- inherit (src.meta) homepage;
- inherit (ssreflect.meta) platforms;
- maintainers = [ stdenv.lib.maintainers.vbgl ];
- broken = (version == "broken");
+ coqeal = version: {
+