diff --git a/pkgs/development/ocaml-modules/sedlex/default.nix b/pkgs/development/ocaml-modules/sedlex/default.nix index cfe1938bf55b..27756fdcd26e 100644 --- a/pkgs/development/ocaml-modules/sedlex/default.nix +++ b/pkgs/development/ocaml-modules/sedlex/default.nix @@ -6,13 +6,19 @@ , gen , ppxlib , uchar +, ppx_expect }: let param = - if lib.versionAtLeast ppxlib.version "0.26.0" then { - version = "3.0"; - sha256 = "sha256-+4ggynMznVfjviMBjXil8CXdMByq4kSmDz6P2PyEETA="; - } else { + if lib.versionAtLeast ppxlib.version "0.26.0" then + if lib.versionAtLeast ocaml.version "4.14" then { + version = "3.1"; + sha256 = "sha256-qG8Wxd/ATwoogeKJDyt5gkGhP5Wvc0j0mMqcoVDkeq4="; + } else { + version = "3.0"; + sha256 = "sha256-+4ggynMznVfjviMBjXil8CXdMByq4kSmDz6P2PyEETA="; + } + else { version = "2.5"; sha256 = "sha256:062a5dvrzvb81l3a9phljrhxfw9nlb61q341q0a6xn65hll3z2wy"; } @@ -34,6 +40,7 @@ let url = "${baseUrl}/ucd/PropList.txt"; sha256 = "sha256-4FwKKBHRE9rkq9gyiEGZo+qNGH7huHLYJAp4ipZUC/0="; }; + atLeast31 = lib.versionAtLeast param.version "3.1"; in buildDunePackage rec { pname = "sedlex"; @@ -49,7 +56,10 @@ buildDunePackage rec { }; propagatedBuildInputs = [ - gen uchar ppxlib + gen + ppxlib + ] ++ lib.optionals (!atLeast31) [ + uchar ]; preBuild = '' @@ -59,6 +69,10 @@ buildDunePackage rec { ln -s ${PropList} src/generator/data/PropList.txt ''; + checkInputs = lib.optionals atLeast31 [ + ppx_expect + ]; + doCheck = true; dontStrip = true;