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