diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index e55fd630cec9..f4c97b9642ec 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -1,6 +1,7 @@ { lib , substituteAll , fetchurl +, fetchpatch , ocaml , dune_3 , buildDunePackage @@ -56,12 +57,24 @@ buildDunePackage { sha256 = hashes."${version}"; }; - patches = [ + patches = let + branch = lib.head (lib.tail (lib.splitString "-" version)); + needsVimPatch = lib.versionOlder version "4.17" || + branch == "502" && lib.versionOlder version "5.2"; + in + [ (substituteAll { src = ./fix-paths.patch; dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; dune = "${dune_3}/bin/dune"; }) + ] ++ lib.optionals needsVimPatch [ + # https://github.com/ocaml/merlin/pull/1798 + (fetchpatch { + name = "vim-python-12-syntax-warning-fix.patch"; + url = "https://github.com/ocaml/merlin/commit/9e0c47b0d5fd0c4edc37c4c7ce927b155877557d.patch"; + hash = "sha256-HmdTISE/s45C5cwLgsCHNUW6OAPSsvQ/GcJE6VDEobs="; + }) ]; strictDeps = true; diff --git a/pkgs/development/tools/ocaml/merlin/default.nix b/pkgs/development/tools/ocaml/merlin/default.nix index a80252c3dfbc..c37cac53430b 100644 --- a/pkgs/development/tools/ocaml/merlin/default.nix +++ b/pkgs/development/tools/ocaml/merlin/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchurl, buildDunePackage, substituteAll +{ lib, fetchurl, fetchpatch, buildDunePackage, substituteAll , dot-merlin-reader, dune_2, yojson, csexp, result, menhirSdk }: buildDunePackage rec { @@ -18,6 +18,12 @@ buildDunePackage rec { dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; dune = "${dune_2}/bin/dune"; }) + # https://github.com/ocaml/merlin/pull/1798 + (fetchpatch { + name = "vim-python-12-syntax-warning-fix.patch"; + url = "https://github.com/ocaml/merlin/commit/9e0c47b0d5fd0c4edc37c4c7ce927b155877557d.patch"; + hash = "sha256-HmdTISE/s45C5cwLgsCHNUW6OAPSsvQ/GcJE6VDEobs="; + }) ]; strictDeps = true;