Skip to content

Commit ab255a6

Browse files
proux01vbgl
authored andcommitted
coqPackages.coq-elpi: enable to override ocamlPackages.elpi version
1 parent c21233f commit ab255a6

File tree

1 file changed

+37
-23
lines changed

1 file changed

+37
-23
lines changed

pkgs/development/coq-modules/coq-elpi/default.nix

+37-23
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,30 @@
55
coq,
66
stdlib,
77
version ? null,
8+
elpi-version ? null,
89
}:
910

1011
let
11-
elpi = coq.ocamlPackages.elpi.override (
12-
lib.switch coq.coq-version [
13-
{ case = "8.11"; out = { version = "1.11.4"; }; }
14-
{ case = "8.12"; out = { version = "1.12.0"; }; }
15-
{ case = "8.13"; out = { version = "1.13.7"; }; }
16-
{ case = "8.14"; out = { version = "1.13.7"; }; }
17-
{ case = "8.15"; out = { version = "1.15.0"; }; }
18-
{ case = "8.16"; out = { version = "1.17.0"; }; }
19-
{ case = "8.17"; out = { version = "1.17.0"; }; }
20-
{ case = "8.18"; out = { version = "1.18.1"; }; }
21-
{ case = "8.19"; out = { version = "1.18.1"; }; }
22-
{ case = "8.20"; out = { version = "1.19.2"; }; }
23-
] { }
24-
);
25-
in
26-
(mkCoqDerivation {
12+
default-elpi-version = if elpi-version != null then elpi-version else (
13+
lib.switch coq.coq-version [
14+
{ case = "8.11"; out = "1.11.4"; }
15+
{ case = "8.12"; out = "1.12.0"; }
16+
{ case = "8.13"; out = "1.13.7"; }
17+
{ case = "8.14"; out = "1.13.7"; }
18+
{ case = "8.15"; out = "1.15.0"; }
19+
{ case = "8.16"; out = "1.17.0"; }
20+
{ case = "8.17"; out = "1.17.0"; }
21+
{ case = "8.18"; out = "1.18.1"; }
22+
{ case = "8.19"; out = "1.18.1"; }
23+
{ case = "8.20"; out = "1.19.2"; }
24+
] { }
25+
);
26+
elpi = coq.ocamlPackages.elpi.override { version = default-elpi-version; };
27+
propagatedBuildInputs_wo_elpi = [
28+
coq.ocamlPackages.findlib
29+
stdlib
30+
];
31+
derivation = mkCoqDerivation {
2732
pname = "elpi";
2833
repo = "coq-elpi";
2934
owner = "LPCIC";
@@ -81,11 +86,8 @@ in
8186

8287
mlPlugin = true;
8388
useDuneifVersion = v: lib.versions.isGe "2.2.0" v || v == "dev";
84-
propagatedBuildInputs = [
85-
coq.ocamlPackages.findlib
86-
elpi
87-
stdlib
88-
];
89+
90+
propagatedBuildInputs = propagatedBuildInputs_wo_elpi ++ [ elpi ];
8991

9092
preConfigure = ''
9193
make elpi/dune || true
@@ -96,11 +98,23 @@ in
9698
maintainers = [ lib.maintainers.cohencyril ];
9799
license = lib.licenses.lgpl21Plus;
98100
};
99-
}).overrideAttrs
101+
};
102+
patched-derivation1 = derivation.overrideAttrs
103+
(
104+
o:
105+
lib.optionalAttrs (o ? elpi-version)
106+
{
107+
propagatedBuildInputs = propagatedBuildInputs_wo_elpi ++ [
108+
(coq.ocamlPackages.elpi.override { version = o.elpi-version; })
109+
];
110+
}
111+
);
112+
patched-derivation2 = patched-derivation1.overrideAttrs
100113
(
101114
o:
102115
lib.optionalAttrs (o.version != null && (o.version == "dev" || lib.versions.isGe "2.2.0" o.version))
103116
{
104117
propagatedBuildInputs = o.propagatedBuildInputs ++ [ coq.ocamlPackages.ppx_optcomp ];
105118
}
106-
)
119+
);
120+
in patched-derivation2

0 commit comments

Comments
 (0)