From 98f36b2d744c02c844200cc0624ba5bc226660e5 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Wed, 1 Feb 2023 09:20:48 +0100 Subject: [PATCH] ocamlPackages.dune_3: enable for OCaml < 4.08 --- pkgs/development/ocaml-modules/chrome-trace/default.nix | 1 + pkgs/development/ocaml-modules/ordering/default.nix | 1 + pkgs/development/ocaml-modules/xdg/default.nix | 1 + pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix | 1 + pkgs/top-level/ocaml-packages.nix | 7 ++++++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/ocaml-modules/chrome-trace/default.nix b/pkgs/development/ocaml-modules/chrome-trace/default.nix index fb6c14b3362..9c427d34375 100644 --- a/pkgs/development/ocaml-modules/chrome-trace/default.nix +++ b/pkgs/development/ocaml-modules/chrome-trace/default.nix @@ -4,6 +4,7 @@ buildDunePackage rec { pname = "chrome-trace"; inherit (dune_3) src version; + minimalOCamlVersion = "4.08"; duneVersion = "3"; dontAddPrefix = true; diff --git a/pkgs/development/ocaml-modules/ordering/default.nix b/pkgs/development/ocaml-modules/ordering/default.nix index c3bffc013f9..8613ccf9ae0 100644 --- a/pkgs/development/ocaml-modules/ordering/default.nix +++ b/pkgs/development/ocaml-modules/ordering/default.nix @@ -4,6 +4,7 @@ buildDunePackage { pname = "ordering"; inherit (dune_3) version src; duneVersion = "3"; + minimalOCamlVersion = "4.08"; dontAddPrefix = true; diff --git a/pkgs/development/ocaml-modules/xdg/default.nix b/pkgs/development/ocaml-modules/xdg/default.nix index 8d3810fa7e9..52543175e07 100644 --- a/pkgs/development/ocaml-modules/xdg/default.nix +++ b/pkgs/development/ocaml-modules/xdg/default.nix @@ -5,6 +5,7 @@ buildDunePackage rec { inherit (dune_3) src version; duneVersion = "3"; + minimalOCamlVersion = "4.08"; dontAddPrefix = true; diff --git a/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix b/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix index cec91a02f20..8533c1ac41c 100644 --- a/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix +++ b/pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix @@ -7,6 +7,7 @@ buildDunePackage rec { pname = "js_of_ocaml-compiler"; version = "4.1.0"; duneVersion = "3"; + minimalOCamlVersion = "4.08"; src = fetchurl { url = "https://github.com/ocsigen/js_of_ocaml/releases/download/${version}/js_of_ocaml-${version}.tbz"; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 301495961e3..57759ae28ee 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -357,7 +357,12 @@ let then pkgs.dune_2 else throw "dune_2 is not available for OCaml ${ocaml.version}"; - dune_3 = callPackage ../development/tools/ocaml/dune/3.nix { }; + dune_3 = + if lib.versionAtLeast ocaml.version "4.08" + then callPackage ../development/tools/ocaml/dune/3.nix { } + else if lib.versionAtLeast ocaml.version "4.02" + then pkgs.dune_3 + else throw "dune_3 is not available for OCaml ${ocaml.version}"; dune-action-plugin = callPackage ../development/ocaml-modules/dune-action-plugin { };