Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 106 lines 2.8 kB view raw
1{ 2 lib, 3 replaceVars, 4 fetchurl, 5 ocaml, 6 dune_3, 7 buildDunePackage, 8 yojson, 9 csexp, 10 merlin-lib, 11 dot-merlin-reader, 12 jq, 13 menhir, 14 menhirLib, 15 menhirSdk, 16 # Each releases of Merlin support a limited range of versions of OCaml. 17 version ? 18 { 19 "4.12.0" = "4.7-412"; 20 "4.12.1" = "4.7-412"; 21 "4.13.0" = "4.7-413"; 22 "4.13.1" = "4.7-413"; 23 "4.14.0" = "4.19-414"; 24 "4.14.1" = "4.19-414"; 25 "4.14.2" = "4.19-414"; 26 "5.0.0" = "4.14-500"; 27 "5.1.0" = "4.17.1-501"; 28 "5.1.1" = "4.17.1-501"; 29 "5.2.0" = "5.3-502"; 30 "5.2.1" = "5.3-502"; 31 "5.3.0" = "5.5-503"; 32 } 33 ."${ocaml.version}", 34}: 35 36let 37 38 hashes = { 39 "4.7-412" = "sha256-0U3Ia7EblKULNy8AuXFVKACZvGN0arYJv7BWiBRgT0Y="; 40 "4.7-413" = "sha256-aVmGWS4bJBLuwsxDKsng/n0A6qlyJ/pnDTcYab/5gyU="; 41 "4.14-500" = "sha256-7CPzJPh1UgzYiX8wPMbU5ZXz1wAJFNQQcp8WuGrR1w4="; 42 "4.16-414" = "sha256-xekZdfPfVoSeGzBvNWwxcJorE519V2NLjSHkcyZvzy0="; # Used by ocaml-lsp 43 "4.16-501" = "sha256-2lvzCbBAZFwpKuRXLMagpwDb0rz8mWrBPI5cODbCHiY="; # Used by ocaml-lsp 44 "4.18-414" = "sha256-9tb3omYUHjWMGoaWEsgTXIWRhdVH6julya17tn/jDME="; 45 "4.19-414" = "sha256-YKYw9ZIDqc5wR6XwTQ8jmUWWDaxvOBApIuMottJlc4Q="; 46 "4.17.1-501" = "sha256-N2cHqocfCeljlFbT++S4miHJrXXHdOlMu75n+EKwpQA="; 47 "5.3-502" = "sha256-LOpG8SOX+m4x7wwNT14Rwc/ZFu5JQgaUAFyV67OqJLw="; 48 "5.4.1-503" = "sha256-SbO0x3jBISX8dAXnN5CwsxLV15dJ3XPUg4tlYqJTMCI="; 49 "5.5-503" = "sha256-Z9o7NPL+oHZ4JnMJ9h2kosbwgpjeDcWWVbjTD9gmmvE="; 50 }; 51 52in 53 54buildDunePackage { 55 pname = "merlin"; 56 inherit version; 57 58 src = fetchurl { 59 url = "https://github.com/ocaml/merlin/releases/download/v${version}/merlin-${version}.tbz"; 60 sha256 = hashes."${version}"; 61 }; 62 63 patches = 64 let 65 old-patch = lib.versionOlder version "4.17"; 66 in 67 [ 68 (replaceVars (if old-patch then ./fix-paths.patch else ./fix-paths2.patch) { 69 dot-merlin-reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; 70 dune = "${dune_3}/bin/dune"; 71 }) 72 ]; 73 74 strictDeps = true; 75 76 nativeBuildInputs = [ 77 menhir 78 jq 79 ]; 80 buildInputs = [ 81 dot-merlin-reader 82 yojson 83 (if lib.versionAtLeast version "4.7-414" then merlin-lib else csexp) 84 menhirSdk 85 menhirLib 86 ]; 87 88 doCheck = false; 89 checkPhase = '' 90 runHook preCheck 91 patchShebangs tests/merlin-wrapper 92 dune runtest # filtering with -p disables tests 93 runHook postCheck 94 ''; 95 96 meta = with lib; { 97 description = "Editor-independent tool to ease the development of programs in OCaml"; 98 homepage = "https://github.com/ocaml/merlin"; 99 license = licenses.mit; 100 mainProgram = "ocamlmerlin"; 101 maintainers = [ 102 maintainers.vbgl 103 maintainers.sternenseemann 104 ]; 105 }; 106}