Skip to content

Commit

Permalink
coqPackages.coq-elpi: enable to override ocamlPackages.elpi version
Browse files Browse the repository at this point in the history
  • Loading branch information
proux01 authored and vbgl committed Jan 17, 2025
1 parent c21233f commit ab255a6
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions pkgs/development/coq-modules/coq-elpi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@
coq,
stdlib,
version ? null,
elpi-version ? null,
}:

let
elpi = coq.ocamlPackages.elpi.override (
lib.switch coq.coq-version [
{ case = "8.11"; out = { version = "1.11.4"; }; }
{ case = "8.12"; out = { version = "1.12.0"; }; }
{ case = "8.13"; out = { version = "1.13.7"; }; }
{ case = "8.14"; out = { version = "1.13.7"; }; }
{ case = "8.15"; out = { version = "1.15.0"; }; }
{ case = "8.16"; out = { version = "1.17.0"; }; }
{ case = "8.17"; out = { version = "1.17.0"; }; }
{ case = "8.18"; out = { version = "1.18.1"; }; }
{ case = "8.19"; out = { version = "1.18.1"; }; }
{ case = "8.20"; out = { version = "1.19.2"; }; }
] { }
);
in
(mkCoqDerivation {
default-elpi-version = if elpi-version != null then elpi-version else (
lib.switch coq.coq-version [
{ case = "8.11"; out = "1.11.4"; }
{ case = "8.12"; out = "1.12.0"; }
{ case = "8.13"; out = "1.13.7"; }
{ case = "8.14"; out = "1.13.7"; }
{ case = "8.15"; out = "1.15.0"; }
{ case = "8.16"; out = "1.17.0"; }
{ case = "8.17"; out = "1.17.0"; }
{ case = "8.18"; out = "1.18.1"; }
{ case = "8.19"; out = "1.18.1"; }
{ case = "8.20"; out = "1.19.2"; }
] { }
);
elpi = coq.ocamlPackages.elpi.override { version = default-elpi-version; };
propagatedBuildInputs_wo_elpi = [
coq.ocamlPackages.findlib
stdlib
];
derivation = mkCoqDerivation {
pname = "elpi";
repo = "coq-elpi";
owner = "LPCIC";
Expand Down Expand Up @@ -81,11 +86,8 @@ in

mlPlugin = true;
useDuneifVersion = v: lib.versions.isGe "2.2.0" v || v == "dev";
propagatedBuildInputs = [
coq.ocamlPackages.findlib
elpi
stdlib
];

propagatedBuildInputs = propagatedBuildInputs_wo_elpi ++ [ elpi ];

preConfigure = ''
make elpi/dune || true
Expand All @@ -96,11 +98,23 @@ in
maintainers = [ lib.maintainers.cohencyril ];
license = lib.licenses.lgpl21Plus;
};
}).overrideAttrs
};
patched-derivation1 = derivation.overrideAttrs
(
o:
lib.optionalAttrs (o ? elpi-version)
{
propagatedBuildInputs = propagatedBuildInputs_wo_elpi ++ [
(coq.ocamlPackages.elpi.override { version = o.elpi-version; })
];
}
);
patched-derivation2 = patched-derivation1.overrideAttrs
(
o:
lib.optionalAttrs (o.version != null && (o.version == "dev" || lib.versions.isGe "2.2.0" o.version))
{
propagatedBuildInputs = o.propagatedBuildInputs ++ [ coq.ocamlPackages.ppx_optcomp ];
}
)
);
in patched-derivation2

0 comments on commit ab255a6

Please sign in to comment.