about summary refs log tree commit diff
path: root/pkgs/build-support/ocaml
diff options
context:
space:
mode:
authorVincent Laporte <Vincent.Laporte@gmail.com>2022-03-16 17:30:39 +0100
committerVincent Laporte <vbgl@users.noreply.github.com>2022-03-28 07:08:14 +0200
commit15f220b07ced65b6ca8ed862249bf180b5ace9ca (patch)
treecdf4ae2761413b922d116c25e0ed2a09d89d75fa /pkgs/build-support/ocaml
parent97e586356901b2ea7b6df453caf43b98fae355a3 (diff)
ocamlPackages.buildDunePackage: add support for dune 3
Diffstat (limited to 'pkgs/build-support/ocaml')
-rw-r--r--pkgs/build-support/ocaml/dune.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkgs/build-support/ocaml/dune.nix b/pkgs/build-support/ocaml/dune.nix
index 18e8784cfab30..f82bac7d199db 100644
--- a/pkgs/build-support/ocaml/dune.nix
+++ b/pkgs/build-support/ocaml/dune.nix
@@ -1,8 +1,11 @@
-{ lib, stdenv, ocaml, findlib, dune_1, dune_2 }:
+{ lib, stdenv, ocaml, findlib, dune_1, dune_2, dune_3 }:
 
 { pname, version, nativeBuildInputs ? [], enableParallelBuilding ? true, ... }@args:
 
-let Dune = if args.useDune2 or true then dune_2 else dune_1; in
+let Dune =
+  let dune-version = args . duneVersion or (if args.useDune2 or true then "2" else "1"); in
+  { "1" = dune_1; "2" = dune_2; "3" = dune_3; }."${dune-version}"
+; in
 
 if (args ? minimumOCamlVersion && ! lib.versionAtLeast ocaml.version args.minimumOCamlVersion) ||
    (args ? minimalOCamlVersion && ! lib.versionAtLeast ocaml.version args.minimalOCamlVersion)
@@ -31,7 +34,7 @@ stdenv.mkDerivation ({
     runHook postInstall
   '';
 
-} // (builtins.removeAttrs args [ "minimalOCamlVersion" ]) // {
+} // (builtins.removeAttrs args [ "minimalOCamlVersion" "duneVersion" ]) // {
 
   name = "ocaml${ocaml.version}-${pname}-${version}";