coqPackages: refactor
This commit is contained in:
committed by
Vincent Laporte
parent
04065a7354
commit
9ffd16b385
@@ -1,265 +1,93 @@
|
||||
#############################
|
||||
# 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. #
|
||||
########################################################################
|
||||
############################################################################
|
||||
# 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 passthrough attributes of mathcomp #
|
||||
# bearing the same names (mathcomp.ssreflect, etc). #
|
||||
############################################################################
|
||||
# Compiling a custom version of mathcomp using `mathcomp.override`. #
|
||||
# This is the replacement for the former `mathcomp_ config` function. #
|
||||
# See the documentation at doc/languages-frameworks/coq.section.md. #
|
||||
############################################################################
|
||||
|
||||
############################################################
|
||||
# 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;
|
||||
{ lib, ncurses, which, graphviz, lua,
|
||||
mkCoqDerivation, recurseIntoAttrs, withDoc ? false, single ? false,
|
||||
coqPackages, coq, ocamlPackages, version ? null }@args:
|
||||
with builtins // lib;
|
||||
let
|
||||
mathcomp-config-initial = rec {
|
||||
#######################################################################
|
||||
# CONFIGURATION (please edit this), it is exported as mathcomp-config #
|
||||
#######################################################################
|
||||
# sha256 of released mathcomp versions
|
||||
sha256 = {
|
||||
"1.12.0" = "1ccfny1vwgmdl91kz5xlmhq4wz078xm4z5wpd0jy5rn890dx03wp";
|
||||
"1.11.0" = "06a71d196wd5k4wg7khwqb7j7ifr7garhwkd54s86i0j7d6nhl3c";
|
||||
"1.11+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.12.0" = flip elem [ "8.13" ];
|
||||
"1.11.0" = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" "8.12" ];
|
||||
"1.11+beta1" = flip elem [ "8.7" "8.8" "8.9" "8.10" "8.11" "8.12" ];
|
||||
"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.12.0" "1.10.0" "1.11.0" "1.9.0" "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;
|
||||
repo = "math-comp";
|
||||
owner = "math-comp";
|
||||
withDoc = single && (args.withDoc or false);
|
||||
defaultVersion = with versions; switch coq.coq-version [
|
||||
{ case = isGe "8.13"; out = "1.12.0"; } # lower version of coq to 8.10 when all mathcomp packages are ported
|
||||
{ case = range "8.7" "8.12"; out = "1.11.0"; }
|
||||
{ case = range "8.7" "8.11"; out = "1.10.0"; }
|
||||
{ case = range "8.7" "8.11"; out = "1.9.0"; }
|
||||
{ case = range "8.7" "8.9"; out = "1.8.0"; }
|
||||
{ case = range "8.6" "8.9"; out = "1.7.0"; }
|
||||
{ case = range "8.5" "8.7"; out = "1.6.4"; }
|
||||
] null;
|
||||
release = {
|
||||
"1.12.0".sha256 = "1ccfny1vwgmdl91kz5xlmhq4wz078xm4z5wpd0jy5rn890dx03wp";
|
||||
"1.11.0".sha256 = "06a71d196wd5k4wg7khwqb7j7ifr7garhwkd54s86i0j7d6nhl3c";
|
||||
"1.10.0".sha256 = "1b9m6pwxxyivw7rgx82gn5kmgv2mfv3h3y0mmjcjfypi8ydkrlbv";
|
||||
"1.9.0".sha256 = "0lid9zaazdi3d38l8042lczb02pw5m9wq0yysiilx891hgq2p81r";
|
||||
"1.8.0".sha256 = "07l40is389ih8bi525gpqs3qp4yb2kl11r9c8ynk1ifpjzpnabwp";
|
||||
"1.7.0".sha256 = "0wnhj9nqpx2bw6n1l4i8jgrw3pjajvckvj3lr4vzjb3my2lbxdd1";
|
||||
"1.6.4".sha256 = "09ww48qbjsvpjmy1g9yhm0rrkq800ffq21p6fjkbwd34qvd82raz";
|
||||
"1.6.1".sha256 = "1ilw6vm4dlsdv9cd7kmf0vfrh2kkzr45wrqr8m37miy0byzr4p9i";
|
||||
};
|
||||
releaseRev = v: "mathcomp-${v}";
|
||||
|
||||
##############################################################
|
||||
# COMPUTED using the configuration above (edit with caution) #
|
||||
##############################################################
|
||||
# list of core mathcomp packages sorted by dependency order
|
||||
packages = [ "ssreflect" "fingroup" "algebra" "solvable" "field" "character" "all" ];
|
||||
|
||||
# generic split function (TODO: move to lib?)
|
||||
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;
|
||||
|
||||
pkgUp = l: r: l // r // {
|
||||
meta = (l.meta or {}) // (r.meta or {});
|
||||
passthru = (l.passthru or {}) // (r.passthru or {});
|
||||
};
|
||||
|
||||
coq = coqPackages.coq;
|
||||
mathcomp-deps = mathcomp-config.deps mathcomp.config.preferred-version;
|
||||
|
||||
# default set of attributes given a 'package' name.
|
||||
# this attribute set will be extended using toOverrideFun
|
||||
default-attrs = package:
|
||||
let
|
||||
mathcomp_ = package: let
|
||||
mathcomp-deps = if package == "single" then []
|
||||
else map mathcomp_ (head (splitList (pred.equal package) packages));
|
||||
pkgpath = if package == "single" then "mathcomp" else "mathcomp/${package}";
|
||||
pkgname = if package == "single" then "mathcomp" else "mathcomp-${package}";
|
||||
pname = if package == "single" then "mathcomp" else "mathcomp-${package}";
|
||||
pkgallMake = ''
|
||||
echo "all.v" > Make
|
||||
echo "-I ." >> Make
|
||||
echo "-R . mathcomp.all" >> Make
|
||||
'';
|
||||
in
|
||||
rec {
|
||||
version = "master";
|
||||
name = "coq${coq.coq-version}-${pkgname}-${version}";
|
||||
derivation = mkCoqDerivation ({
|
||||
inherit version pname defaultVersion release releaseRev repo owner;
|
||||
|
||||
nativeBuildInputs = optionals withDoc [ graphviz ];
|
||||
buildInputs = [ ncurses which ] ++ (with coq.ocamlPackages; [ ocaml findlib camlp5 ]);
|
||||
propagatedBuildInputs = [ coq ];
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = optional withDoc graphviz;
|
||||
mlPlugin = versions.isLe "8.6" coq.coq-version;
|
||||
extraBuildInputs = [ ncurses which ] ++ optional withDoc lua;
|
||||
propagatedBuildInputs = mathcomp-deps;
|
||||
|
||||
buildFlags = optional withDoc "doc";
|
||||
|
||||
COQBIN = "${coq}/bin/";
|
||||
|
||||
preBuild = ''
|
||||
patchShebangs etc/utils/ssrcoqdep || true
|
||||
'' + ''
|
||||
cd ${pkgpath}
|
||||
'' + optionalString (package == "all") pkgallMake;
|
||||
|
||||
installPhase = ''
|
||||
make -f Makefile.coq COQLIB=$out/lib/coq/${coq.coq-version}/ install
|
||||
'' + optionalString withDoc ''
|
||||
make -f Makefile.coq install-doc DOCDIR=$out/share/coq/${coq.coq-version}/
|
||||
'';
|
||||
installTargets = "install" + optionalString withDoc " doc";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = {
|
||||
homepage = "https://math-comp.github.io/";
|
||||
license = licenses.cecill-b;
|
||||
maintainers = [ maintainers.vbgl maintainers.jwiegley maintainers.cohencyril ];
|
||||
platforms = coq.meta.platforms;
|
||||
maintainers = with maintainers; [ vbgl jwiegley cohencyril ];
|
||||
};
|
||||
|
||||
passthru = {
|
||||
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
|
||||
stdenv.mkDerivation (up (up (default-attrs package) overrides) fixdeps);
|
||||
} // optionalAttrs (package != "single") { passthru = genAttrs packages mathcomp_; });
|
||||
patched-derivation1 = derivation.overrideAttrs (o:
|
||||
optionalAttrs (o.pname != null && o.pname == "mathcomp-all" &&
|
||||
o.version != null && o.version != "dev" && versions.isLt "1.7" o.version)
|
||||
{ preBuild = ""; buildPhase = ""; installPhase = "echo doing nothing"; }
|
||||
);
|
||||
patched-derivation = patched-derivation1.overrideAttrs (o:
|
||||
optionalAttrs (versions.isLe "8.7" coq.coq-version ||
|
||||
(o.version != "dev" && versions.isLe "1.7" o.version))
|
||||
{
|
||||
installFlags = o.installFlags ++ [ "-f Makefile.coq" ];
|
||||
}
|
||||
);
|
||||
in patched-derivation;
|
||||
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;
|
||||
}
|
||||
mathcomp_ (if single then "single" else "all")
|
||||
|
||||
@@ -1,391 +0,0 @@
|
||||
##########################################################
|
||||
# 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
|
||||
##############################
|
||||
# CONFIGURATION, please edit #
|
||||
##############################
|
||||
############################
|
||||
# Packages base delaration #
|
||||
############################
|
||||
rec-mathcomp-extra-config = {
|
||||
initial = {
|
||||
mathcomp-finmap = {version, coqPackages}: {
|
||||
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" ];
|
||||
};
|
||||
|
||||
mathcomp-bigenough = {version, coqPackages}: {
|
||||
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" ];
|
||||
};
|
||||
|
||||
multinomials = {version, coqPackages}: {
|
||||
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" ];
|
||||
};
|
||||
|
||||
mathcomp-analysis = {version, coqPackages}: {
|
||||
propagatedBuildInputs = with coqPackages;
|
||||
[ mathcomp.field mathcomp-finmap mathcomp-bigenough mathcomp-real-closed ];
|
||||
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" ];
|
||||
};
|
||||
|
||||
mathcomp-real-closed = {version, coqPackages}: {
|
||||
propagatedBuildInputs = with coqPackages;
|
||||
[ 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" ];
|
||||
};
|
||||
|
||||
coqeal = {version, coqPackages}: {
|
||||
buildInputs = [ which ];
|
||||
propagatedBuildInputs = with coqPackages;
|
||||
[ mathcomp-algebra bignums paramcoq multinomials ];
|
||||
meta = {
|
||||
description = "CoqEAL - The Coq Effective Algebra Library";
|
||||
homepage = "https://github.com/coqeal/coqeal";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
owner = "CoqEAL";
|
||||
};
|
||||
passthru.compatibleCoqVersions = flip elem [ "8.9" "8.10" "8.11" ];
|
||||
};
|
||||
};
|
||||
|
||||
###############################
|
||||
# sha256 of released versions #
|
||||
###############################
|
||||
sha256 = {
|
||||
mathcomp-finmap = {
|
||||
"1.5.0" = "0vx9n1fi23592b3hv5p5ycy7mxc8qh1y5q05aksfwbzkk5zjkwnq";
|
||||
"1.4.1" = "0kx4nx24dml1igk0w0qijmw221r5bgxhwhl5qicnxp7ab3c35s8p";
|
||||
"1.4.0+coq-8.11" = "1fd00ihyx0kzq5fblh9vr8s5mr1kg7p6pk11c4gr8svl1n69ppmb";
|
||||
"1.4.0" = "0mp82mcmrs424ff1vj3cvd8353r9vcap027h3p0iprr1vkkwjbzd";
|
||||
"1.3.4" = "0f5a62ljhixy5d7gsnwd66gf054l26k3m79fb8nz40i2mgp6l9ii";
|
||||
"1.3.3" = "1n844zjhv354kp4g4pfbajix0plqh7yxv6471sgyb46885298am5";
|
||||
"1.3.1" = "14rvm0rm5hd3pd0srgak3jqmddzfv6n7gdpjwhady5xcgrc7gsx7";
|
||||
"1.2.1" = "0jryb5dq8js3imbmwrxignlk5zh8gwfb1wr4b1s7jbwz410vp7zf";
|
||||
"1.2.0" = "0b6wrdr0d7rcnv86s37zm80540jl2wmiyf39ih7mw3dlwli2cyj4";
|
||||
"1.1.0" = "05df59v3na8jhpsfp7hq3niam6asgcaipg2wngnzxzqnl86srp2a";
|
||||
"1.0.0" = "0sah7k9qm8sw17cgd02f0x84hki8vj8kdz7h15i7rmz08rj0whpa";
|
||||
};
|
||||
mathcomp-bigenough = {
|
||||
"1.0.0" = "10g0gp3hk7wri7lijkrqna263346wwf6a3hbd4qr9gn8hmsx70wg";
|
||||
};
|
||||
mathcomp-analysis = {
|
||||
"0.3.1" = "1iad288yvrjv8ahl9v18vfblgqb1l5z6ax644w49w9hwxs93f2k8";
|
||||
"0.3.0" = "03klwi4fja0cqb4myp3kgycfbmdv00bznmxf8yg3zzzzw997hjqc";
|
||||
"0.2.3" = "0p9mr8g1qma6h10qf7014dv98ln90dfkwn76ynagpww7qap8s966";
|
||||
"0.2.2" = "1d5dwg9di2ppdzfg21zr0a691zigb5kz0lcw263jpyli1nrq7cvk";
|
||||
"0.2.0" = "1186xjxgns4ns1szyi931964bjm0mp126qzlv10mkqqgfw07nhrd";
|
||||
"0.1.0" = "0hwkr2wzy710pcyh274fcarzdx8sv8myp16pv0vq5978nmih46al";
|
||||
};
|
||||
multinomials = {
|
||||
"1.5.2" = "15aspf3jfykp1xgsxf8knqkxv8aav2p39c2fyirw7pwsfbsv2c4s";
|
||||
"1.5.1" = "13nlfm2wqripaq671gakz5mn4r0xwm0646araxv0nh455p9ndjs3";
|
||||
"1.5" = "064rvc0x5g7y1a0nip6ic91vzmq52alf6in2bc2dmss6dmzv90hw";
|
||||
"1.4" = "0vnkirs8iqsv8s59yx1fvg1nkwnzydl42z3scya1xp1b48qkgn0p";
|
||||
"1.3" = "0l3vi5n094nx3qmy66hsv867fnqm196r8v605kpk24gl0aa57wh4";
|
||||
"1.2" = "1mh1w339dslgv4f810xr1b8v2w7rpx6fgk9pz96q0fyq49fw2xcq";
|
||||
"1.1" = "1q8alsm89wkc0lhcvxlyn0pd8rbl2nnxg81zyrabpz610qqjqc3s";
|
||||
"1.0" = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
|
||||
};
|
||||
mathcomp-real-closed = {
|
||||
"1.1.1" = "0ksjscrgq1i79vys4zrmgvzy2y4ylxa8wdsf4kih63apw6v5ws6b";
|
||||
"1.1.0" = "0zgfmrlximw77bw5w6w0xg2nampp02pmrwnrzx8m1n5pqljnv8fh";
|
||||
"1.0.5" = "0q8nkxr9fba4naylr5xk7hfxsqzq2pvwlg1j0xxlhlgr3fmlavg2";
|
||||
"1.0.4" = "058v9dj973h9kfhqmvcy9a6xhhxzljr90cf99hdfcdx68fi2ha1b";
|
||||
"1.0.3" = "1xbzkzqgw5p42dx1liy6wy8lzdk39zwd6j14fwvv5735k660z7yb";
|
||||
"1.0.2" = "0097pafwlmzd0gyfs31bxpi1ih04i72nxhn99r93aj20mn7mcsgl";
|
||||
"1.0.1" = "0j81gkjbza5vg89v4n9z598mfdbql416963rj4b8fzm7dp2r4rxg";
|
||||
};
|
||||
coqeal = {
|
||||
"1.0.4" = "1g5m26lr2lwxh6ld2gykailhay4d0ayql4bfh0aiwqpmmczmxipk";
|
||||
"1.0.3" = "0hc63ny7phzbihy8l7wxjvn3haxx8jfnhi91iw8hkq8n29i23v24";
|
||||
"1.0.2" = "1brmf3gj03iky1bcl3g9vx8vknny7xfvs0y2rfr85am0296sxsfj";
|
||||
"1.0.1" = "19jhdrv2yp9ww0h8q73ihb2w1z3glz4waf2d2n45klafxckxi7bm";
|
||||
"1.0.0" = "1had6f1n85lmh9x31avbmgl3m0rsiw9f8ma95qzk5b57fjg5k1ii";
|
||||
};
|
||||
};
|
||||
|
||||
################################
|
||||
# CONSISTENT sets of packages. #
|
||||
################################
|
||||
for-coq-and-mc = let
|
||||
v6 = {
|
||||
mathcomp-finmap = "1.5.0";
|
||||
mathcomp-bigenough = "1.0.0";
|
||||
mathcomp-analysis = "0.3.1";
|
||||
multinomials = "1.5.2";
|
||||
mathcomp-real-closed = "1.1.1";
|
||||
coqeal = "1.0.4";
|
||||
};
|
||||
v5 = {
|
||||
mathcomp-finmap = "1.5.0";
|
||||
mathcomp-bigenough = "1.0.0";
|
||||
mathcomp-analysis = "0.3.0";
|
||||
multinomials = "1.5.1";
|
||||
mathcomp-real-closed = "1.0.5";
|
||||
coqeal = "1.0.4";
|
||||
};
|
||||
v4 = v3 // { coqeal = "1.0.3"; };
|
||||
v3 = {
|
||||
mathcomp-finmap = "1.4.0";
|
||||
mathcomp-bigenough = "1.0.0";
|
||||
mathcomp-analysis = "0.2.3";
|
||||
multinomials = "1.5";
|
||||
mathcomp-real-closed = "1.0.4";
|
||||
coqeal = "1.0.0";
|
||||
};
|
||||
v2 = {
|
||||
mathcomp-finmap = "1.3.4";
|
||||
mathcomp-bigenough = "1.0.0";
|
||||
mathcomp-analysis = "0.2.3";
|
||||
multinomials = "1.4";
|
||||
mathcomp-real-closed = "1.0.3";
|
||||
coqeal = "1.0.0";
|
||||
};
|
||||
v1 = {
|
||||
mathcomp-finmap = "1.1.0";
|
||||
mathcomp-bigenough = "1.0.0";
|
||||
multinomials = "1.1";
|
||||
mathcomp-real-closed = "1.0.1";
|
||||
coqeal = "1.0.0";
|
||||
};
|
||||
in
|
||||
{
|
||||
"8.11" = {
|
||||
"1.11.0" = v6;
|
||||
"1.11+beta1" = v5;
|
||||
"1.10.0" = v4 // {mathcomp-finmap = "1.4.0+coq-8.11";};
|
||||
};
|
||||
"8.10" = {
|
||||
"1.11.0" = removeAttrs v6 ["coqeal"];
|
||||
"1.11+beta1" = removeAttrs v5 ["coqeal"];
|
||||
"1.10.0" = v4;
|
||||
"1.9.0" = removeAttrs v3 ["coqeal"];
|
||||
};
|
||||
"8.9" = {
|
||||
"1.11.0" = removeAttrs v6 ["mathcomp-analysis"];
|
||||
"1.11+beta1" = removeAttrs v5 ["mathcomp-analysis"];
|
||||
"1.10.0" = v4;
|
||||
"1.9.0" = removeAttrs v3 ["coqeal"];
|
||||
"1.8.0" = removeAttrs v2 ["coqeal"];
|
||||
};
|
||||
"8.8" = {
|
||||
"1.11.0" = removeAttrs v6 ["mathcomp-analysis"];
|
||||
"1.11+beta1" = removeAttrs v5 ["mathcomp-analysis"];
|
||||
"1.10.0" = removeAttrs v4 ["mathcomp-analysis"];
|
||||
"1.9.0" = removeAttrs v3 ["coqeal"];
|
||||
"1.8.0" = removeAttrs v2 ["coqeal"];
|
||||
"1.7.0" = removeAttrs v1 ["coqeal" "multinomials"];
|
||||
};
|
||||
"8.7" = {
|
||||
"1.11.0" = removeAttrs v6 ["mathcomp-analysis"];
|
||||
"1.11+beta1" = removeAttrs v5 ["mathcomp-analysis"];
|
||||
"1.10.0" = removeAttrs v4 ["mathcomp-analysis"];
|
||||
"1.9.0" = removeAttrs v3 ["coqeal" "mathcomp-analysis"];
|
||||
"1.8.0" = removeAttrs v2 ["coqeal" "mathcomp-analysis"];
|
||||
"1.7.0" = removeAttrs v1 ["coqeal" "multinomials"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
##############################
|
||||
# GENERATION, EDIT WITH CARE #
|
||||
##############################
|
||||
coq = coqPackages.coq;
|
||||
|
||||
default-attrs = {
|
||||
version = "master";
|
||||
buildInputs = [];
|
||||
propagatedBuildInputs = (with coqPackages; [ ssreflect ]);
|
||||
installFlags = [ "-f" "Makefile.coq" "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
|
||||
meta = {
|
||||
inherit (mathcomp.meta) platforms license;
|
||||
owner = "math-comp";
|
||||
maintainers = [ maintainers.vbgl maintainers.cohencyril ];
|
||||
};
|
||||
passthru.compatibleCoqVersions = (_: true);
|
||||
};
|
||||
|
||||
pkgUp = recursiveUpdateUntil (path: l: r: !(isAttrs l && isAttrs r) || path == ["src"]);
|
||||
|
||||
# Fixes a partial attribute set using the configuration
|
||||
# in the style of the above mathcomp-extra-config.initial,
|
||||
# and generates a name according to the conventional naming scheme below
|
||||
fix-attrs = pkgcfg:
|
||||
let attrs = pkgUp default-attrs pkgcfg; in
|
||||
pkgUp attrs (rec {
|
||||
name = "coq${coq.coq-version}mathcomp${mathcomp.version}-${attrs.meta.repo or attrs.meta.package or "anonymous"}-${attrs.version}";
|
||||
src = attrs.src or (fetchTarball "${meta.homepage}/archive/${attrs.version}.tar.gz");
|
||||
meta = rec {
|
||||
homepage = attrs.meta.homepage or attrs.src.meta.homepage or "https://github.com/${owner}/${repo}";
|
||||
owner = attrs.meta.owner or "math-comp";
|
||||
repo = attrs.meta.repo or attrs.meta.package or "math-comp-nix";
|
||||
};
|
||||
});
|
||||
|
||||
# Gets a version out of a string, path or attribute set.
|
||||
getVersion = arg:
|
||||
if isFunction arg then (arg {}).version
|
||||
else if arg == "" then "master"
|
||||
else if isDerivation arg then arg.drvAttrs.version or "master"
|
||||
else if isAttrs arg then arg.version or "master"
|
||||
else if isString arg then head (reverseList (split "/" arg))
|
||||
else if isPath arg then (baseNameOf arg)
|
||||
else "master";
|
||||
|
||||
# Converts a string, path or attribute set into an override function
|
||||
# It tries to fill the `old` argument of the override function using
|
||||
# `mathcomp-extra-config.initial` first and finishes with `fix-attrs`
|
||||
rec-mathcomp-extra-override = generic: old: let
|
||||
version = getVersion generic;
|
||||
package = old.meta.package or "math-comp-nix";
|
||||
cfg = pkgUp ((mathcomp-extra-config.initial.${package} or (_: {}))
|
||||
{ inherit version coqPackages; }) old
|
||||
// { inherit version; };
|
||||
fix = attrs: fix-attrs (pkgUp cfg attrs);
|
||||
in
|
||||
if isFunction generic then fix (generic cfg)
|
||||
else if generic == null || generic == "" then fix {}
|
||||
else if isDerivation generic then generic.drvAttrs
|
||||
else if isAttrs generic then fix generic
|
||||
else if generic == "broken" then fix { meta.broken = true; passthru.compatibleCoqVersions = _: false; }
|
||||
else let fixedcfg = fix cfg; in fixedcfg // (
|
||||
if isString generic then
|
||||
if (mathcomp-extra-config.sha256.${package} or {})?${generic} then {
|
||||
src = fetchFromGitHub {
|
||||
inherit (fixedcfg.meta) owner repo;
|
||||
rev = version;
|
||||
sha256 = mathcomp-extra-config.sha256.${package}.${version};
|
||||
};
|
||||
}
|
||||
else let splitted = filter isString (split "/" generic); in {
|
||||
src = fetchTarball
|
||||
("https://github.com/" +
|
||||
(if length splitted == 1 then "${fixedcfg.meta.owner}/${fixedcfg.meta.repo}/archive/${version}.tar.gz"
|
||||
else "${head splitted}/${fixedcfg.meta.repo}/archive/${concatStringsSep "/" (tail splitted)}.tar.gz"));
|
||||
}
|
||||
else if isPath generic then { src = generic; }
|
||||
else abort "${toString generic} not a legitimate generic version/override");
|
||||
|
||||
# applies mathcomp-extra-config.for-coq-and-mc to the current mathcomp version
|
||||
for-this = mathcomp-extra-config.for-coq-and-mc.${coq.coq-version}.${mathcomp.version} or {};
|
||||
|
||||
# specializes mathcomp-extra to the current mathcomp version.
|
||||
rec-current-mathcomp-extra = package: mathcomp-extra package (for-this.${package} or {});
|
||||
in
|
||||
{
|
||||
mathcomp-extra-override = rec-mathcomp-extra-override;
|
||||
mathcomp-extra-config = rec-mathcomp-extra-config;
|
||||
current-mathcomp-extra = rec-current-mathcomp-extra;
|
||||
mathcomp-extra = package: version:
|
||||
stdenv.mkDerivation (mathcomp-extra-override version {meta = {inherit package;};});
|
||||
|
||||
mathcomp-finmap = current-mathcomp-extra "mathcomp-finmap";
|
||||
mathcomp-analysis = current-mathcomp-extra "mathcomp-analysis";
|
||||
mathcomp-bigenough = current-mathcomp-extra "mathcomp-bigenough";
|
||||
multinomials = current-mathcomp-extra "multinomials";
|
||||
mathcomp-real-closed = current-mathcomp-extra "mathcomp-real-closed";
|
||||
coqeal = current-mathcomp-extra "coqeal";
|
||||
|
||||
mathcomp-extra-fast = map current-mathcomp-extra
|
||||
(attrNames (filterAttrs (pkg: config: !(config?slow && config.slow)) for-this));
|
||||
mathcomp-extra-all = map current-mathcomp-extra (attrNames for-this);
|
||||
}
|
||||
Reference in New Issue
Block a user