2021-03-18 17:15:41 +01:00
|
|
|
{ lib
|
|
|
|
, substituteAll
|
|
|
|
, fetchurl
|
|
|
|
, ocaml
|
|
|
|
, dune_2
|
|
|
|
, buildDunePackage
|
|
|
|
, yojson
|
|
|
|
, csexp
|
|
|
|
, result
|
|
|
|
, dot-merlin-reader
|
|
|
|
, jq
|
|
|
|
, menhir
|
2021-05-29 15:50:56 +02:00
|
|
|
, menhirLib
|
|
|
|
, menhirSdk
|
2021-03-18 17:15:41 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-10-03 16:09:52 +02:00
|
|
|
merlinVersion = "4.3.1";
|
2021-03-18 17:15:41 +01:00
|
|
|
|
|
|
|
hashes = {
|
2021-10-03 16:09:52 +02:00
|
|
|
"4.3.1-411" = "0lhxkd1wa8k3fkcnhvzlahx3g519cdi5h7lgs60khqqm8nfvfcr5";
|
|
|
|
"4.3.1-412" = "0ah2zbj1hhrrfxp4nhfh47jsbkvm0b30dr7ikjpmvb13wa8h20sr";
|
2021-03-18 17:15:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
ocamlVersionShorthand = lib.concatStrings
|
|
|
|
(lib.take 2 (lib.splitVersion ocaml.version));
|
|
|
|
|
|
|
|
version = "${merlinVersion}-${ocamlVersionShorthand}";
|
|
|
|
in
|
|
|
|
|
|
|
|
if !lib.hasAttr version hashes
|
|
|
|
then builtins.throw "merlin ${merlinVersion} is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
buildDunePackage {
|
|
|
|
pname = "merlin";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/ocaml/merlin/releases/download/v${version}/merlin-v${version}.tbz";
|
|
|
|
sha256 = hashes."${version}";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
|
|
|
dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader";
|
|
|
|
dune = "${dune_2}/bin/dune";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
useDune2 = true;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
dot-merlin-reader
|
|
|
|
yojson
|
|
|
|
csexp
|
|
|
|
result
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
patchShebangs tests/merlin-wrapper
|
|
|
|
dune runtest # filtering with -p disables tests
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
checkInputs = [
|
|
|
|
jq
|
|
|
|
menhir
|
2021-05-29 15:50:56 +02:00
|
|
|
menhirLib
|
|
|
|
menhirSdk
|
2021-03-18 17:15:41 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "An editor-independent tool to ease the development of programs in OCaml";
|
|
|
|
homepage = "https://github.com/ocaml/merlin";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.vbgl maintainers.sternenseemann ];
|
|
|
|
};
|
|
|
|
}
|