nixpkgs/pkgs/development/tools/ocaml/merlin/4.x.nix
Vincent Laporte f09f7f1778 ocamlPackages.yojson: 1.7.0 → 2.0.2
ocamlPackages.merlin: 3.4.2 → 3.8.0

ocamlPackages.merlin: 4.5 → 4.6

ocamlPackages.{atd,atdgen}: 2.9.1 → 2.10.0

ocamlPackages.elpi: fix build with atd 2.10.0
2022-08-29 08:10:02 +02:00

84 lines
1.7 KiB
Nix

{ lib
, substituteAll
, fetchurl
, ocaml
, dune_2
, buildDunePackage
, yojson
, csexp
, merlin-lib
, dot-merlin-reader
, jq
, menhir
, menhirLib
, menhirSdk
}:
let
merlinVersion = "4.6";
hashes = {
"4.6-412" = "sha256-isiurLeWminJQQR4oHpJPCzVk6cEmtQdX4+n3Pdka5c=";
"4.6-413" = "sha256-8903H4TE6F/v2Kw1XpcpdXEiLIdb9llYgt42zSR9kO4=";
"4.6-414" = "sha256-AuvXCjx32JQBY9vkxAd0pEjtFF6oTgrT1f9TJEEDk84=";
};
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-${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";
})
];
strictDeps = true;
nativeBuildInputs = [
menhir
jq
];
buildInputs = [
dot-merlin-reader
yojson
(if lib.versionAtLeast version "4.6-414"
then merlin-lib
else csexp)
menhirSdk
menhirLib
];
doCheck = true;
checkPhase = ''
runHook preCheck
patchShebangs tests/merlin-wrapper
dune runtest # filtering with -p disables tests
runHook postCheck
'';
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 ];
};
}