about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-02-07 07:30:22 +0100
committerGitHub <noreply@github.com>2023-02-07 07:30:22 +0100
commitb6eac37960e801d046f62b80bf4137ed6f689794 (patch)
tree7ec2cc497b5eb2ea555edfb1b73b73235a0f55bb
parent479ee91658cf835247558bd022c28524a4c95427 (diff)
parent62a2cfe3636c69ba81c1aea16a473abad15dab30 (diff)
Merge pull request #213932 from vbgl/ocaml-dune3
ocamlPackages.dune_3: enable for OCaml < 4.08
-rw-r--r--pkgs/development/ocaml-modules/checkseum/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/chrome-trace/default.nix1
-rw-r--r--pkgs/development/ocaml-modules/ordering/default.nix1
-rw-r--r--pkgs/development/ocaml-modules/xdg/default.nix1
-rw-r--r--pkgs/development/tools/ocaml/js_of_ocaml/compiler.nix1
-rw-r--r--pkgs/top-level/ocaml-packages.nix7
6 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/development/ocaml-modules/checkseum/default.nix b/pkgs/development/ocaml-modules/checkseum/default.nix
index 0b14aa57c749a..498dcdfe04cbc 100644
--- a/pkgs/development/ocaml-modules/checkseum/default.nix
+++ b/pkgs/development/ocaml-modules/checkseum/default.nix
@@ -10,10 +10,11 @@ buildDunePackage rec {
   pname = "checkseum";
 
   minimalOCamlVersion = "4.07";
+  duneVersion = "3";
 
   src = fetchurl {
     url = "https://github.com/mirage/checkseum/releases/download/v${version}/checkseum-${version}.tbz";
-    sha256 = "sha256-K6QPMts5+hxH2a+WQ1N0lwMBoshG2T0bSozNgzRvAlo=";
+    hash = "sha256-K6QPMts5+hxH2a+WQ1N0lwMBoshG2T0bSozNgzRvAlo=";
   };
 
   buildInputs = [ dune-configurator ];
diff --git a/pkgs/development/ocaml-modules/chrome-trace/default.nix b/pkgs/development/ocaml-modules/chrome-trace/default.nix
index fb6c14b3362ea..9c427d343758e 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 c3bffc013f95e..8613ccf9ae088 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 8d3810fa7e9e6..52543175e07cc 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 5faccab938ee8..de8906dba44b6 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 301495961e334..57759ae28eec2 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 { };