coqPackages.mathcomp-analysis: avoid top-level with ...;

This commit is contained in:
Philip Taron 2024-03-14 14:53:57 -07:00
parent 94112e3ae5
commit e8955041c3
No known key found for this signature in database

View File

@ -1,10 +1,10 @@
{ lib,
mkCoqDerivation, recurseIntoAttrs,
mkCoqDerivation,
mathcomp, mathcomp-finmap, mathcomp-bigenough,
hierarchy-builder,
single ? false,
coqPackages, coq, version ? null }@args:
with builtins // lib;
let
repo = "analysis";
owner = "math-comp";
@ -30,20 +30,21 @@ let
release."0.3.1".sha256 = "1iad288yvrjv8ahl9v18vfblgqb1l5z6ax644w49w9hwxs93f2k8";
release."0.2.3".sha256 = "0p9mr8g1qma6h10qf7014dv98ln90dfkwn76ynagpww7qap8s966";
defaultVersion = with versions; lib.switch [ coq.version mathcomp.version ] [
{ cases = [ (range "8.17" "8.19") (range "2.0.0" "2.2.0") ]; out = "1.1.0"; }
defaultVersion = let inherit (lib.versions) range; in
lib.switch [ coq.version mathcomp.version ] [
{ cases = [ (range "8.17" "8.19") (range "2.0.0" "2.2.0") ]; out = "1.1.0"; }
{ cases = [ (range "8.17" "8.19") (range "1.17.0" "1.19.0") ]; out = "0.7.0"; }
{ cases = [ (range "8.17" "8.18") (range "1.15.0" "1.18.0") ]; out = "0.6.7"; }
{ cases = [ (range "8.17" "8.18") (range "1.15.0" "1.18.0") ]; out = "0.6.6"; }
{ cases = [ (range "8.14" "8.18") (range "1.15.0" "1.17.0") ]; out = "0.6.5"; }
{ cases = [ (range "8.14" "8.18") (range "1.13.0" "1.16.0") ]; out = "0.6.1"; }
{ cases = [ (range "8.14" "8.18") (range "1.13" "1.15") ]; out = "0.5.2"; }
{ cases = [ (range "8.13" "8.15") (range "1.13" "1.14") ]; out = "0.5.1"; }
{ cases = [ (range "8.13" "8.15") (range "1.12" "1.14") ]; out = "0.3.13"; }
{ cases = [ (range "8.11" "8.14") (range "1.12" "1.13") ]; out = "0.3.10"; }
{ cases = [ (range "8.10" "8.12") "1.11.0" ]; out = "0.3.3"; }
{ cases = [ (range "8.10" "8.11") "1.11.0" ]; out = "0.3.1"; }
{ cases = [ (range "8.8" "8.11") (range "1.8" "1.10") ]; out = "0.2.3"; }
{ cases = [ (range "8.14" "8.18") (range "1.13" "1.15") ]; out = "0.5.2"; }
{ cases = [ (range "8.13" "8.15") (range "1.13" "1.14") ]; out = "0.5.1"; }
{ cases = [ (range "8.13" "8.15") (range "1.12" "1.14") ]; out = "0.3.13"; }
{ cases = [ (range "8.11" "8.14") (range "1.12" "1.13") ]; out = "0.3.10"; }
{ cases = [ (range "8.10" "8.12") "1.11.0" ]; out = "0.3.3"; }
{ cases = [ (range "8.10" "8.11") "1.11.0" ]; out = "0.3.1"; }
{ cases = [ (range "8.8" "8.11") (range "1.8" "1.10") ]; out = "0.2.3"; }
] null;
# list of analysis packages sorted by dependency order
@ -52,7 +53,7 @@ let
mathcomp_ = package: let
classical-deps = [ mathcomp.algebra mathcomp-finmap ];
analysis-deps = [ mathcomp.field mathcomp-bigenough ];
intra-deps = lib.optionals (package != "single") (map mathcomp_ (head (splitList (lib.pred.equal package) packages)));
intra-deps = lib.optionals (package != "single") (map mathcomp_ (lib.head (lib.splitList (lib.pred.equal package) packages)));
pkgpath = if package == "single" then "."
else if package == "analysis" then "theories" else "${package}";
pname = if package == "single" then "mathcomp-analysis-single"
@ -64,8 +65,8 @@ let
propagatedBuildInputs =
intra-deps
++ optionals (elem package [ "classical" "single" ]) classical-deps
++ optionals (elem package [ "analysis" "single" ]) analysis-deps;
++ lib.optionals (lib.elem package [ "classical" "single" ]) classical-deps
++ lib.optionals (lib.elem package [ "analysis" "single" ]) analysis-deps;
preBuild = ''
cd ${pkgpath}
@ -73,26 +74,26 @@ let
meta = {
description = "Analysis library compatible with Mathematical Components";
maintainers = [ maintainers.cohencyril ];
license = licenses.cecill-c;
maintainers = [ lib.maintainers.cohencyril ];
license = lib.licenses.cecill-c;
};
passthru = genAttrs packages mathcomp_;
passthru = lib.genAttrs packages mathcomp_;
});
# split packages didn't exist before 0.6, so bulding nothing in that case
patched-derivation1 = derivation.overrideAttrs (o:
optionalAttrs (o.pname != null && o.pname != "mathcomp-analysis" &&
o.version != null && o.version != "dev" && versions.isLt "0.6" o.version)
lib.optionalAttrs (o.pname != null && o.pname != "mathcomp-analysis" &&
o.version != null && o.version != "dev" && lib.versions.isLt "0.6" o.version)
{ preBuild = ""; buildPhase = "echo doing nothing"; installPhase = "echo doing nothing"; }
);
patched-derivation2 = patched-derivation1.overrideAttrs (o:
optionalAttrs (o.pname != null && o.pname == "mathcomp-analysis" &&
o.version != null && o.version != "dev" && versions.isLt "0.6" o.version)
lib.optionalAttrs (o.pname != null && o.pname == "mathcomp-analysis" &&
o.version != null && o.version != "dev" && lib.versions.isLt "0.6" o.version)
{ preBuild = ""; }
);
patched-derivation = patched-derivation2.overrideAttrs (o:
optionalAttrs (o.version != null
&& (o.version == "dev" || versions.isGe "0.3.4" o.version))
lib.optionalAttrs (o.version != null
&& (o.version == "dev" || lib.versions.isGe "0.3.4" o.version))
{
propagatedBuildInputs = o.propagatedBuildInputs ++ [ hierarchy-builder ];
}