about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/ocaml-modules')
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/asn1-combinators/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/atd/default.nix20
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/atdgen/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/bap/default.nix24
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/base64/default.nix15
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/batteries/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/bigarray-compat/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/bigstring/default.nix9
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/biniou/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/bitstring/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/bitstring/ppx.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ca-certs/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/camomile/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/carton/default.nix67
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/carton/git.nix28
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/carton/lwt.nix46
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cohttp/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cpu/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cpuid/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/crowbar/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/csexp/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/decompress/default.nix14
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/digestif/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/directories/default.nix33
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/dtoa/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/duff/default.nix21
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/eliom/default.nix15
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/elpi/default.nix3
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/encore/default.nix11
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/extlib/default.nix25
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/faraday/async.nix14
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/faraday/lwt-unix.nix12
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/faraday/lwt.nix12
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git-http/default.nix15
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git-unix/default.nix20
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git/cohttp-mirage.nix18
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git/cohttp-unix.nix17
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git/cohttp.nix19
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git/default.nix23
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/git/unix.nix38
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/gnuplot/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/graphics/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/gsl/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/hidapi/default.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/hxd/default.nix23
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/imagelib/default.nix24
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/imagelib/unix.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/index/default.nix22
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/integers/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/chunk.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/containers.nix27
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/default.nix24
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/git.nix26
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/graphql.nix14
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/http.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/layers.nix18
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/mem.nix21
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-git.nix27
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-graphql.nix21
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/mirage.nix15
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/pack.nix9
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/ppx.nix20
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/test.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/irmin/unix.nix12
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/0.12.nix7
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/0.14.nix45
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/default.nix7
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/labltk/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/linenoise/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/lru/default.nix7
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/luv/default.nix35
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mariadb/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/merlin-extend/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mimic/default.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/minisat/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mirage-clock/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mirage-clock/freestanding.nix23
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mirage-clock/unix.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/default.nix21
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/ec.nix55
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/mmap/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/npy/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-cairo/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/configurable-binding.patch49
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/default.nix87
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/no-opam.patch84
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/camomile.nix16
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/stub.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix79
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix31
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix44
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/2.1.x.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-result/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-version/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocamlnet/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocsigen-server/default.nix5
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/opti/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/optint/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ounit2/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/owl-base/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/parany/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/parmap/default.nix10
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/pbkdf/default.nix30
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/pgocaml/default.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/pgocaml/ppx.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_bap/default.nix51
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_cstubs/default.nix44
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_derivers/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_deriving/default.nix29
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_import/default.nix17
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppx_yojson_conv_lib/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ppxlib/default.nix11
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/psmt2-frontend/default.nix28
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/psq/default.nix7
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/qcheck/core.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/qtest/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/re/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/rope/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/sha/default.nix28
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/sodium/default.nix5
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/sodium/lib-gen-link-bigarray.patch7
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/sosa/default.nix8
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/spacetime_lib/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/spelll/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/sqlite3/default.nix5
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/stdint/default.nix41
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/stdlib-shims/default.nix5
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/tcpip/default.nix15
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/tcpip/makefile-no-opam.patch12
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/torch/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/uucp/default.nix26
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/visitors/default.nix6
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/wodan/irmin.nix10
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/wtf8/default.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix4
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/zarith/default.nix33
141 files changed, 1646 insertions, 451 deletions
diff --git a/nixpkgs/pkgs/development/ocaml-modules/asn1-combinators/default.nix b/nixpkgs/pkgs/development/ocaml-modules/asn1-combinators/default.nix
index ddc181a49928..289f6a6cba4b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/asn1-combinators/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/asn1-combinators/default.nix
@@ -6,13 +6,13 @@ buildDunePackage rec {
   minimumOCamlVersion = "4.05";
 
   pname = "asn1-combinators";
-  version = "0.2.4";
+  version = "0.2.5";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirleft/ocaml-asn1-combinators/releases/download/v${version}/asn1-combinators-v${version}.tbz";
-    sha256 = "09rn5wwqhwg7x51b9ycl15s7007hgha6lwaz2bpw85fr70jq3i9r";
+    sha256 = "1pbcdwm12hnfpd1jv2b7cjfkj5r7h61xp2gr8dysb8waa455kwln";
   };
 
   propagatedBuildInputs = [ cstruct zarith bigarray-compat stdlib-shims ptime ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/atd/default.nix b/nixpkgs/pkgs/development/ocaml-modules/atd/default.nix
index e4edac5fdc10..2f85221e539c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/atd/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/atd/default.nix
@@ -1,22 +1,22 @@
-{ lib, menhir, easy-format, fetchFromGitHub, buildDunePackage, which, biniou, yojson }:
+{ lib, menhir, easy-format, fetchurl, buildDunePackage, which, re }:
 
 buildDunePackage rec {
   pname = "atd";
-  version = "2.0.0";
+  version = "2.2.1";
+
+  useDune2 = true;
 
   minimumOCamlVersion = "4.02";
 
-  src = fetchFromGitHub {
-    owner = "mjambon";
-    repo = pname;
-    rev = version;
-    sha256 = "0alzmk97rxg7s6irs9lvf89dy9n3r769my5n4j9p9qyigcdgjaia";
+  src = fetchurl {
+    url = "https://github.com/ahrefs/atd/releases/download/2.2.1/atd-2.2.1.tbz";
+    sha256 = "17jm79np69ixp53a4njxnlb1pg8sd1g47nm3nyki9clkc8d4qsyv";
   };
 
-  createFindlibDestdir = true;
-
   buildInputs = [ which menhir ];
-  propagatedBuildInputs = [ easy-format biniou yojson ];
+  propagatedBuildInputs = [ easy-format re ];
+
+  doCheck = true;
 
   meta = with lib; {
     homepage = "https://github.com/mjambon/atd";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/atdgen/default.nix b/nixpkgs/pkgs/development/ocaml-modules/atdgen/default.nix
index d8ef2fec9990..2537c92d97a5 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/atdgen/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/atdgen/default.nix
@@ -3,7 +3,7 @@
 let runtime =
   buildDunePackage {
     pname = "atdgen-runtime";
-    inherit (atd) version src;
+    inherit (atd) version useDune2 src;
 
     propagatedBuildInputs = [ biniou yojson ];
 
@@ -13,7 +13,7 @@ let runtime =
 
 buildDunePackage {
   pname = "atdgen";
-  inherit (atd) version src;
+  inherit (atd) version useDune2 src;
 
   buildInputs = [ atd ];
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/bap/default.nix b/nixpkgs/pkgs/development/ocaml-modules/bap/default.nix
index 9284bbaf9c62..94f254a2edfb 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/bap/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/bap/default.nix
@@ -2,28 +2,26 @@
 , ocaml, findlib, ocamlbuild, ocaml_oasis
 , bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm, frontc, ounit, ppx_jane, parsexp
 , utop, libxml2, ncurses
+, linenoise
+, ppx_bap
 , ppx_bitstring
-, ppx_tools_versioned
+, yojson
 , which, makeWrapper, writeText
 , z3
 }:
 
-if !lib.versionAtLeast ocaml.version "4.07"
+if !lib.versionAtLeast ocaml.version "4.08"
 then throw "BAP is not available for OCaml ${ocaml.version}"
 else
 
-if lib.versionAtLeast core_kernel.version "0.13"
-then throw "BAP needs core_kernel-0.12 (hence OCaml 4.07)"
-else
-
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-bap-${version}";
-  version = "2.1.0";
+  version = "2.2.0";
   src = fetchFromGitHub {
     owner = "BinaryAnalysisPlatform";
     repo = "bap";
     rev = "v${version}";
-    sha256 = "10fkr6p798ad18j4h9bvp9dg4pmjdpv3hmj7k389i0vhqniwi5xq";
+    sha256 = "0c53sps6ba9n5cjdmapi8ylzlpcc11pksijp9swzlwgxyz5d276f";
   };
 
   sigs = fetchurl {
@@ -41,12 +39,14 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ which makeWrapper ];
 
   buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis
-                  llvm ppx_bitstring ppx_tools_versioned
+                  linenoise
+                  ounit
+                  ppx_bitstring
                   z3
                   utop libxml2 ncurses ];
 
-  propagatedBuildInputs = [ bitstring camlzip cmdliner ppx_jane core_kernel ezjsonm fileutils ocaml_lwt ocamlgraph ocurl re uri zarith piqi parsexp
-                            piqi-ocaml uuidm frontc ounit ];
+  propagatedBuildInputs = [ bitstring camlzip cmdliner ppx_bap core_kernel ezjsonm fileutils ocaml_lwt ocamlgraph ocurl re uri zarith piqi parsexp
+                            piqi-ocaml uuidm frontc yojson ];
 
   installPhase = ''
     export OCAMLPATH=$OCAMLPATH:$OCAMLFIND_DESTDIR;
@@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
   patches = [ ./curses_is_ncurses.patch ];
 
   preConfigure = ''
-    substituteInPlace oasis/elf --replace bitstring.ppx ppx_bitstring
+    substituteInPlace oasis/elf-loader --replace bitstring.ppx ppx_bitstring
   '';
 
   configureFlags = [ "--enable-everything ${disableIda}" "--with-llvm-config=${llvm}/bin/llvm-config" ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/base64/default.nix b/nixpkgs/pkgs/development/ocaml-modules/base64/default.nix
index de0bc13e2833..efb7f41b95dd 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/base64/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/base64/default.nix
@@ -1,20 +1,21 @@
-{ lib, fetchurl, buildDunePackage, alcotest, bos, dune-configurator }:
+{ lib, fetchurl, buildDunePackage, ocaml, alcotest, bos, rresult }:
 
 buildDunePackage rec {
   pname = "base64";
-  version = "3.4.0";
+  version = "3.5.0";
+
+  minimumOCamlVersion = "4.03";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/ocaml-base64/releases/download/v${version}/base64-v${version}.tbz";
-    sha256 = "0d0n5gd4nkdsz14jnxq13f1f7rzxmndg5xql039a8wfppmazd70w";
+    sha256 = "sha256-WJ3pwAV46/54QZismBjTWGxHSyMWts0+HEbMsfYq46Q=";
   };
 
-  buildInputs = [ bos dune-configurator ];
-
-  doCheck = true;
-  checkInputs = [ alcotest ];
+  # otherwise fmt breaks evaluation
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ alcotest bos rresult ];
 
   meta = {
     homepage = "https://github.com/mirage/ocaml-base64";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/batteries/default.nix b/nixpkgs/pkgs/development/ocaml-modules/batteries/default.nix
index d4b7f3ff9a12..7785a70e0509 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/batteries/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/batteries/default.nix
@@ -1,13 +1,13 @@
 { stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, qtest, num }:
 
-let version = "3.2.0"; in
+let version = "3.3.0"; in
 
 stdenv.mkDerivation {
   name = "ocaml${ocaml.version}-batteries-${version}";
 
   src = fetchurl {
     url = "https://github.com/ocaml-batteries-team/batteries-included/releases/download/v${version}/batteries-${version}.tar.gz";
-    sha256 = "0a77njgc6c6kz4rpwqgmnii7f1na6hzsa55nqqm3dndhq9xh628w";
+    sha256 = "002pqkcg18zx59hsf172wg6s7lwsiagp5sfvf5yssp7xxal5jdgx";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/bigarray-compat/default.nix b/nixpkgs/pkgs/development/ocaml-modules/bigarray-compat/default.nix
index 6d833b48f269..487249ce5ae5 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/bigarray-compat/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/bigarray-compat/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "bigarray-compat";
   version = "1.0.0";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "mirage";
     repo = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/bigstring/default.nix b/nixpkgs/pkgs/development/ocaml-modules/bigstring/default.nix
index 98687262c33b..f966e0b90b1b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/bigstring/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/bigstring/default.nix
@@ -2,7 +2,9 @@
 
 buildDunePackage rec {
   pname = "bigstring";
-  version = "0.2";
+  version = "0.3";
+
+  useDune2 = true;
 
   minimumOCamlVersion = "4.03";
 
@@ -10,10 +12,11 @@ buildDunePackage rec {
     owner = "c-cube";
     repo = "ocaml-bigstring";
     rev = version;
-    sha256 = "0ypdf29cmwmjm3djr5ygz8ls81dl41a4iz1xx5gbcdpbrdiapb77";
+    sha256 = "0bkxwdcswy80f6rmx5wjza92xzq4rdqsb4a9fm8aav8bdqx021n8";
   };
 
-  doCheck = true;
+  # Circular dependency with bigstring-unix
+  doCheck = false;
 
   meta = with lib; {
     homepage = "https://github.com/c-cube/ocaml-bigstring";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/biniou/default.nix b/nixpkgs/pkgs/development/ocaml-modules/biniou/default.nix
index 8e0780ae6c5c..535b34b03dcd 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/biniou/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/biniou/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "biniou";
   version = "1.2.1";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "ocaml-community";
     repo = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/bitstring/default.nix b/nixpkgs/pkgs/development/ocaml-modules/bitstring/default.nix
index 583017d9ddec..12ed4ae787da 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/bitstring/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/bitstring/default.nix
@@ -2,7 +2,7 @@
 
 buildDunePackage rec {
   pname = "bitstring";
-  version = "4.0.1";
+  version = "4.1.0";
 
   useDune2 = true;
 
@@ -10,7 +10,7 @@ buildDunePackage rec {
     owner = "xguerin";
     repo = pname;
     rev = "v${version}";
-    sha256 = "1z7jmgljvp52lvn3ml2cp6gssxqp4sikwyjf6ym97cycbcw0fjjm";
+    sha256 = "0mghsl8b2zd2676mh1r9142hymhvzy9cw8kgkjmirxkn56wbf56b";
   };
 
   propagatedBuildInputs = [ stdlib-shims ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/bitstring/ppx.nix b/nixpkgs/pkgs/development/ocaml-modules/bitstring/ppx.nix
index ee0a8c51f732..4d391d3458dc 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/bitstring/ppx.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/bitstring/ppx.nix
@@ -3,6 +3,10 @@
 , ounit
 }:
 
+if !lib.versionAtLeast ppxlib.version "0.18.0"
+then throw "ppx_bitstring is not available with ppxlib-${ppxlib.version}"
+else
+
 buildDunePackage rec {
   pname = "ppx_bitstring";
   inherit (bitstring) version useDune2 src;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ca-certs/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ca-certs/default.nix
index 65b411c52d52..dacc181f751c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ca-certs/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ca-certs/default.nix
@@ -4,13 +4,13 @@
 
 buildDunePackage rec {
   pname = "ca-certs";
-  version = "0.1.3";
+  version = "0.2.0";
 
   minimumOCamlVersion = "4.07";
 
   src = fetchurl {
     url = "https://github.com/mirage/ca-certs/releases/download/v${version}/ca-certs-v${version}.tbz";
-    sha256 = "0jpghxjp2n8wx6ig0d2x87ycaql6mb92w8ai3xh3jb288m7g02zn";
+    sha256 = "15jfb5zvahs90jsfs7ridqihlka5198z2xrvplj8ddchxfmpx868";
   };
 
   useDune2 = true;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/camomile/default.nix b/nixpkgs/pkgs/development/ocaml-modules/camomile/default.nix
index 6bae728cafac..ec20eedd7688 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/camomile/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/camomile/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "camomile";
   version = "1.0.2";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "yoriyuki";
     repo = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/carton/default.nix b/nixpkgs/pkgs/development/ocaml-modules/carton/default.nix
new file mode 100644
index 000000000000..31b864e29d32
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/carton/default.nix
@@ -0,0 +1,67 @@
+{ lib, buildDunePackage, fetchurl
+, ke, duff, decompress, cstruct, optint, bigstringaf, stdlib-shims
+, bigarray-compat, checkseum, logs, psq, fmt
+, result, rresult, fpath, base64, bos, digestif, mmap, alcotest
+, crowbar, alcotest-lwt, lwt, findlib, mirage-flow, cmdliner, hxd
+}:
+
+buildDunePackage rec {
+  pname = "carton";
+  version = "0.4.0";
+
+  useDune2 = true;
+  minimumOCamlVersion = "4.08";
+
+  src = fetchurl {
+    url = "https://github.com/mirage/ocaml-git/releases/download/${pname}-v${version}/${pname}-${pname}-v${version}.tbz";
+    sha256 = "777f9692b83cd63570c17527a32c5045818ab9242d923cbbde72fc23d0da0140";
+  };
+
+  # remove changelogs for mimic and the git* packages
+  postPatch = ''
+    rm CHANGES.md CHANGES.mimic.md
+  '';
+
+  buildInputs = [
+    cmdliner
+    digestif
+    mmap
+    result
+    rresult
+    fpath
+    bos
+    hxd
+  ];
+  propagatedBuildInputs = [
+    ke
+    duff
+    decompress
+    cstruct
+    optint
+    bigstringaf
+    stdlib-shims
+    bigarray-compat
+    checkseum
+    logs
+    psq
+    fmt
+  ];
+
+  doCheck = true;
+  checkInputs = [
+    base64
+    alcotest
+    alcotest-lwt
+    crowbar
+    lwt
+    findlib
+    mirage-flow
+  ];
+
+  meta = with lib; {
+    description = "Implementation of PACKv2 file in OCaml";
+    license = licenses.mit;
+    homepage = "https://github.com/mirage/ocaml-git";
+    maintainers = [ maintainers.sternenseemann ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/carton/git.nix b/nixpkgs/pkgs/development/ocaml-modules/carton/git.nix
new file mode 100644
index 000000000000..ef41ff2b5947
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/carton/git.nix
@@ -0,0 +1,28 @@
+{ buildDunePackage, carton, carton-lwt
+, bigarray-compat, bigstringaf, lwt, fpath, result
+, mmap, fmt, decompress, astring
+, alcotest, alcotest-lwt, cstruct, logs
+, mirage-flow, rresult, ke
+}:
+
+buildDunePackage {
+  pname = "carton-git";
+
+  inherit (carton) version src useDune2 minimumOCamlVersion postPatch;
+
+  propagatedBuildInputs = [
+    carton
+    carton-lwt
+    bigarray-compat
+    bigstringaf
+    lwt
+    fpath
+    result
+    mmap
+    fmt
+    decompress
+    astring
+  ];
+
+  inherit (carton) meta;
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/carton/lwt.nix b/nixpkgs/pkgs/development/ocaml-modules/carton/lwt.nix
new file mode 100644
index 000000000000..024ff51559e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/carton/lwt.nix
@@ -0,0 +1,46 @@
+{ buildDunePackage, carton
+, lwt, decompress, optint, bigstringaf
+, alcotest, alcotest-lwt, cstruct, fmt, logs
+, mirage-flow, result, rresult, bigarray-compat
+, ke, base64, bos, checkseum, digestif, fpath, mmap
+, stdlib-shims
+, git-binary # pkgs.git
+}:
+
+buildDunePackage {
+  pname = "carton-lwt";
+
+  inherit (carton) version src useDune2 minimumOCamlVersion postPatch;
+
+  propagatedBuildInputs = [
+    carton
+    lwt
+    decompress
+    optint
+    bigstringaf
+  ];
+
+  doCheck = true;
+  checkInputs = [
+    git-binary
+    alcotest
+    alcotest-lwt
+    cstruct
+    fmt
+    logs
+    mirage-flow
+    result
+    rresult
+    bigarray-compat
+    ke
+    base64
+    bos
+    checkseum
+    digestif
+    fpath
+    mmap
+    stdlib-shims
+  ];
+
+  inherit (carton) meta;
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cohttp/default.nix b/nixpkgs/pkgs/development/ocaml-modules/cohttp/default.nix
index e664d17f215e..1cbc43bc2804 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cohttp/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cohttp/default.nix
@@ -1,11 +1,12 @@
 { lib, fetchurl, buildDunePackage
 , ppx_fields_conv, ppx_sexp_conv, stdlib-shims
 , base64, fieldslib, jsonm, re, stringext, uri-sexp
+, ocaml, fmt, alcotest
 }:
 
 buildDunePackage rec {
   pname = "cohttp";
-  version = "2.5.4";
+  version = "2.5.5";
 
   useDune2 = true;
 
@@ -13,13 +14,16 @@ buildDunePackage rec {
 
   src = fetchurl {
     url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${version}/cohttp-v${version}.tbz";
-    sha256 = "1q04spmki5zis5p5m1vs77i3k7ijm134j62g61071vblwx25z17a";
+    sha256 = "0ywmql4lp6ps2gd064ixbjzsdnnn5vk3pipm005sswl553qqwaim";
   };
 
   buildInputs = [ jsonm ppx_fields_conv ppx_sexp_conv ];
 
   propagatedBuildInputs = [ base64 fieldslib re stringext uri-sexp stdlib-shims ];
 
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ fmt alcotest ];
+
   meta = {
     description = "HTTP(S) library for Lwt, Async and Mirage";
     license = lib.licenses.isc;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cpu/default.nix b/nixpkgs/pkgs/development/ocaml-modules/cpu/default.nix
index 083f00d5d5f1..33702ca18296 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cpu/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cpu/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "cpu";
   version = "2.0.0";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "UnixJunkie";
     repo   = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cpuid/default.nix b/nixpkgs/pkgs/development/ocaml-modules/cpuid/default.nix
index 8adca8b956f6..a0c28bc92d9a 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cpuid/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cpuid/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "cpuid";
   version = "0.1.2";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.03";
 
   src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/crowbar/default.nix b/nixpkgs/pkgs/development/ocaml-modules/crowbar/default.nix
index d05d15286bf7..e114e7d8433a 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/crowbar/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/crowbar/default.nix
@@ -5,6 +5,8 @@ buildDunePackage rec {
   pname = "crowbar";
   version = "0.2";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner  = "stedolan";
     repo   = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/csexp/default.nix b/nixpkgs/pkgs/development/ocaml-modules/csexp/default.nix
index 26c064d6ff51..4bb83019dc5c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/csexp/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/csexp/default.nix
@@ -2,7 +2,7 @@
 
 buildDunePackage rec {
   pname = "csexp";
-  version = "1.3.2";
+  version = "1.4.0";
 
   useDune2 = true;
 
@@ -10,7 +10,7 @@ buildDunePackage rec {
 
   src = fetchurl {
     url = "https://github.com/ocaml-dune/csexp/releases/download/${version}/csexp-${version}.tbz";
-    sha256 = "0jhwrxfjb0x31xj4g4b89fzw34sq19j0rq2hs2zyh1vz4xxl47zj";
+    sha256 = "sha256-jj1vyofxAqEm3ui3KioNFG8QQ5xHIY38FJ1Rvz7fNk4=";
   };
 
   propagatedBuildInputs = [ result ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
index 9cb3a3d4cb87..f8ccffcf217f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ctypes/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchzip, ocaml, findlib, libffi, pkg-config, ncurses, integers }:
+{ lib, stdenv, fetchzip, ocaml, findlib, libffi, pkg-config, ncurses, integers, bigarray-compat }:
 
 if !lib.versionAtLeast ocaml.version "4.02"
 then throw "ctypes is not available for OCaml ${ocaml.version}"
@@ -6,16 +6,16 @@ else
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-ctypes-${version}";
-  version = "0.17.1";
+  version = "0.18.0";
 
   src = fetchzip {
     url = "https://github.com/ocamllabs/ocaml-ctypes/archive/${version}.tar.gz";
-    sha256 = "16brmdnz7wi2z25qqhd5s5blyq4app6jbv6g9pa4vyg6h0nzbcys";
+    sha256 = "03zrbnl16m67ls0yfhq7a4k4238x6x6b3m456g4dw2yqwc153vks";
   };
 
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ ocaml findlib ncurses ];
-  propagatedBuildInputs = [ integers libffi ];
+  propagatedBuildInputs = [ integers libffi bigarray-compat ];
 
   buildPhase =  ''
      make XEN=false libffi.config ctypes-base ctypes-stubs
diff --git a/nixpkgs/pkgs/development/ocaml-modules/decompress/default.nix b/nixpkgs/pkgs/development/ocaml-modules/decompress/default.nix
index 067fac33d455..d2cba68d732e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/decompress/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/decompress/default.nix
@@ -1,22 +1,24 @@
 { lib, fetchurl, buildDunePackage
-, checkseum, cmdliner
-, alcotest, bos, camlzip, mmap, re
+, checkseum, bigarray-compat, optint, cmdliner
+, bigstringaf, alcotest, camlzip, base64, ctypes, fmt
 }:
 
 buildDunePackage rec {
-  version = "0.9.0";
+  version = "1.3.0";
   pname = "decompress";
 
+  minimumOCamlVersion = "4.07";
+
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/decompress/releases/download/v${version}/decompress-v${version}.tbz";
-    sha256 = "0fryhcvv96vfca51c7kqdn3n3canqsbbvfbi75ya6lca4lmpipbh";
+    sha256 = "de149896939be13fedec46a4581121d5ab74850a2241d08e6aa8ae4bb18c52c4";
   };
 
   buildInputs = [ cmdliner ];
-  propagatedBuildInputs = [ checkseum ];
-  checkInputs = lib.optionals doCheck [ alcotest bos camlzip mmap re ];
+  propagatedBuildInputs = [ optint bigarray-compat checkseum ];
+  checkInputs = [ alcotest bigstringaf ctypes fmt camlzip base64 ];
   doCheck = true;
 
   meta = {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/digestif/default.nix b/nixpkgs/pkgs/development/ocaml-modules/digestif/default.nix
index dd8a0f571649..e2501c60f5a1 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/digestif/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/digestif/default.nix
@@ -5,13 +5,13 @@
 
 buildDunePackage rec {
   pname = "digestif";
-  version = "0.9.0";
+  version = "1.0.0";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/digestif/releases/download/v${version}/digestif-v${version}.tbz";
-    sha256 = "0vk9prgjp46xs8qizq7szkj6mqjj2ymncs2016bc8zswcdc1a3q4";
+    sha256 = "11188ya6ksb0p0zvs6saz3qxv4a8pyy8m3sq35f3qfxrxhghqi99";
   };
 
   propagatedBuildInputs = [ bigarray-compat eqaf stdlib-shims ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/directories/default.nix b/nixpkgs/pkgs/development/ocaml-modules/directories/default.nix
new file mode 100644
index 000000000000..eae11953113b
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/directories/default.nix
@@ -0,0 +1,33 @@
+{ lib, fetchFromGitHub, buildDunePackage }:
+
+buildDunePackage rec {
+  pname = "directories";
+  version = "0.2";
+  useDune2 = true;
+
+  minimumOCamlVersion = "4.07";
+
+  src = fetchFromGitHub {
+    owner = "ocamlpro";
+    repo = pname;
+    rev = version;
+    sha256 = "0s7ginh0g0fhw8xf9v58cx99a8q9jqsf4i0p134m5qzf84qpjwff";
+  };
+
+  meta = {
+    homepage = "https://github.com/ocamlpro/directories";
+    description = "An OCaml library that provides configuration, cache and data paths (and more!) following the suitable conventions on Linux, macOS and Windows";
+    longDescription = ''
+      directories is an OCaml library that provides configuration, cache and
+      data paths (and more!) following the suitable conventions on Linux, macOS
+      and Windows. It is inspired by similar libraries for other languages such
+      as directories-jvm.
+
+      The following conventions are used: XDG Base Directory Specification and
+      xdg-user-dirs on Linux, Known Folders on Windows, Standard Directories on
+      macOS.
+    '';
+    license = lib.licenses.isc;
+    maintainers = with lib.maintainers; [ bcc32 ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/dtoa/default.nix b/nixpkgs/pkgs/development/ocaml-modules/dtoa/default.nix
index 62fa7cd08c8b..da075f5c7982 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/dtoa/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/dtoa/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "dtoa";
   version = "0.3.2";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.02";
 
   src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/duff/default.nix b/nixpkgs/pkgs/development/ocaml-modules/duff/default.nix
index 8c9dad42fd7a..a57f8564d9e1 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/duff/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/duff/default.nix
@@ -1,24 +1,29 @@
-{ lib, fetchurl, buildDunePackage
-, cstruct, fmt
-, bos, cmdliner, fpath, logs
-, alcotest
+{ lib, fetchurl, buildDunePackage, fetchpatch
+, stdlib-shims, bigarray-compat, fmt
+, alcotest, hxd, crowbar, bigstringaf
 }:
 
 buildDunePackage rec {
   pname = "duff";
-  version = "0.2";
+  version = "0.4";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/duff/releases/download/v${version}/duff-v${version}.tbz";
-    sha256 = "0bi081w4349cqc1n9jsjh1lrcqlnv3nycmvh9fniscv8lz1c0gjq";
+    sha256 = "4795e8344a2c2562e0ef6c44ab742334b5cd807637354715889741b20a461da4";
   };
 
-  buildInputs = [ bos cmdliner fpath logs ] ++ lib.optional doCheck alcotest;
-  propagatedBuildInputs = [ cstruct fmt ];
+  propagatedBuildInputs = [ stdlib-shims bigarray-compat fmt ];
 
   doCheck = true;
+  checkInputs = [
+    alcotest
+    crowbar
+    hxd
+    bigstringaf
+  ];
+
 
   meta = {
     description = "Pure OCaml implementation of libXdiff (Rabin’s fingerprint)";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/eliom/default.nix b/nixpkgs/pkgs/development/ocaml-modules/eliom/default.nix
index 4c845273d714..92d89afe398d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/eliom/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/eliom/default.nix
@@ -1,6 +1,7 @@
-{ stdenv, lib, fetchzip, which, ocsigen_server, ocaml,
+{ stdenv, lib, fetchzip, fetchpatch, which, ocsigen_server, ocaml,
   lwt_react,
   opaline, ppx_deriving, findlib
+, ocaml-migrate-parsetree
 , ppx_tools_versioned
 , js_of_ocaml-ocamlbuild, js_of_ocaml-ppx, js_of_ocaml-ppx_deriving_json
 , js_of_ocaml-lwt
@@ -22,7 +23,17 @@ stdenv.mkDerivation rec
     sha256 = "00m6v2k4mg8705dy41934lznl6gj91i6dk7p1nkaccm51nna25kz";
   };
 
-  buildInputs = [ ocaml which findlib js_of_ocaml-ocamlbuild js_of_ocaml-ppx_deriving_json opaline
+  patches = [
+    # Compatibility with js_of_ocaml >= 3.9.0, remove at next release
+    (fetchpatch {
+      url = "https://github.com/ocsigen/eliom/commit/4106a4217956f7b74a8ef3f73a1e1f55e02ade45.patch";
+      sha256 = "1cgbvpljn9x6zxirxf3rdjrsdwy319ykz3qq03c36cc40hy2w13p";
+    })
+  ];
+
+  buildInputs = [ ocaml which findlib js_of_ocaml-ocamlbuild
+    ocaml-migrate-parsetree
+    js_of_ocaml-ppx_deriving_json opaline
     ppx_tools_versioned
   ];
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/elpi/default.nix b/nixpkgs/pkgs/development/ocaml-modules/elpi/default.nix
index e2d2a2c5dc9f..5c93c111040b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/elpi/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/elpi/default.nix
@@ -1,10 +1,11 @@
 { stdenv, lib, fetchzip, buildDunePackage, camlp5
 , ppxlib, ppx_deriving, re, perl, ncurses
-, version ? "1.12.0"
+, version ? "1.13.0"
 }:
 with lib;
 let fetched = import ../../../build-support/coq/meta-fetch/default.nix
   {inherit lib stdenv fetchzip; } ({
+    release."1.13.0".sha256 = "0dmzy058m1mkndv90byjaik6lzzfk3aaac7v84mpmkv6my23bygr";
     release."1.12.0".sha256 = "1agisdnaq9wrw3r73xz14yrq3wx742i6j8i5icjagqk0ypmly2is";
     release."1.11.4".sha256 = "1m0jk9swcs3jcrw5yyw5343v8mgax238cjb03s8gc4wipw1fn9f5";
     releaseRev = v: "v${v}";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/encore/default.nix b/nixpkgs/pkgs/development/ocaml-modules/encore/default.nix
index dd05982c3cab..5924845c4f46 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/encore/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/encore/default.nix
@@ -1,19 +1,20 @@
 { lib, buildDunePackage, fetchurl, ocaml
-, fmt, bigstringaf, bigarray-compat
-, bigarray-overlap, angstrom, ke, alcotest }:
+, fmt, bigstringaf, angstrom, alcotest }:
 
 buildDunePackage rec {
   pname = "encore";
-  version = "0.5";
+  version = "0.8";
+
+  minimumOCamlVersion = "4.07";
 
   src = fetchurl {
     url = "https://github.com/mirage/encore/releases/download/v${version}/encore-v${version}.tbz";
-    sha256 = "15n0dla149k9h7migs76wap08z5402qcvxyqxzl887ha6isj3p9n";
+    sha256 = "a406bc9863b04bb424692045939d6c170a2bb65a98521ae5608d25b0559344f6";
   };
 
   useDune2 = true;
 
-  propagatedBuildInputs = [ angstrom ke fmt bigstringaf bigarray-compat bigarray-overlap ];
+  propagatedBuildInputs = [ angstrom fmt bigstringaf ];
   checkInputs = [ alcotest ];
   doCheck = true;
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/extlib/default.nix b/nixpkgs/pkgs/development/ocaml-modules/extlib/default.nix
index a8b1810e51f1..5c7d36fcc08d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/extlib/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/extlib/default.nix
@@ -1,28 +1,29 @@
-{ stdenv, lib, fetchurl, ocaml, findlib, cppo, minimal ? true }:
+{ stdenv, lib, fetchurl, ocaml, findlib, cppo
+# De facto, option minimal seems to be the default. See the README.
+, minimal ? true
+}:
 
-assert lib.versionAtLeast (lib.getVersion ocaml) "3.11";
-
-stdenv.mkDerivation {
-  name = "ocaml${ocaml.version}-extlib-1.7.7";
+stdenv.mkDerivation rec {
+  pname = "ocaml${ocaml.version}-extlib";
+  version = "1.7.8";
 
   src = fetchurl {
-    url = "http://ygrek.org.ua/p/release/ocaml-extlib/extlib-1.7.7.tar.gz";
-    sha256 = "1sxmzc1mx3kg62j8kbk0dxkx8mkf1rn70h542cjzrziflznap0s1";
+    url = "https://ygrek.org/p/release/ocaml-extlib/extlib-${version}.tar.gz";
+    sha256 = "0npq4hq3zym8nmlyji7l5cqk6drx2rkcx73d60rxqh5g8dla8p4k";
   };
 
   buildInputs = [ ocaml findlib cppo ];
 
   createFindlibDestdir = true;
+  dontConfigure = true;
 
-  dontConfigure = true;      # Skip configure
-  # De facto, option minimal=1 seems to be the default.  See the README.
-  buildPhase     = "make ${if minimal then "minimal=1" else ""} build";
-  installPhase   = "make ${if minimal then "minimal=1" else ""} install";
+  makeFlags = lib.optional minimal "minimal=1";
 
   meta = {
     homepage = "https://github.com/ygrek/ocaml-extlib";
     description = "Enhancements to the OCaml Standard Library modules";
-    license = lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21Only;
     platforms = ocaml.meta.platforms or [];
+    maintainers = [ lib.maintainers.sternenseemann ];
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/faraday/async.nix b/nixpkgs/pkgs/development/ocaml-modules/faraday/async.nix
new file mode 100644
index 000000000000..666eb684925c
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/faraday/async.nix
@@ -0,0 +1,14 @@
+{ buildDunePackage, faraday, core, async }:
+
+buildDunePackage rec {
+  pname = "faraday-async";
+  inherit (faraday) version src useDune2;
+
+  minimumOCamlVersion = "4.08";
+
+  propagatedBuildInputs = [ faraday core async ];
+
+  meta = faraday.meta // {
+    description = "Async support for Faraday";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt-unix.nix b/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt-unix.nix
new file mode 100644
index 000000000000..23914de26575
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt-unix.nix
@@ -0,0 +1,12 @@
+{ buildDunePackage, faraday, faraday-lwt, lwt }:
+
+buildDunePackage rec {
+  pname = "faraday-lwt-unix";
+  inherit (faraday) version src useDune2 minimumOCamlVersion;
+
+  propagatedBuildInputs = [ lwt faraday-lwt ];
+
+  meta = faraday.meta // {
+    description = "Lwt + Unix support for Faraday";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt.nix b/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt.nix
new file mode 100644
index 000000000000..7fe7319575c5
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/faraday/lwt.nix
@@ -0,0 +1,12 @@
+{ buildDunePackage, faraday, lwt }:
+
+buildDunePackage rec {
+  pname = "faraday-lwt";
+  inherit (faraday) version src useDune2 minimumOCamlVersion;
+
+  propagatedBuildInputs = [ faraday lwt ];
+
+  meta = faraday.meta // {
+    description = "Lwt support for Faraday";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git-http/default.nix b/nixpkgs/pkgs/development/ocaml-modules/git-http/default.nix
deleted file mode 100644
index 54bd5c2da233..000000000000
--- a/nixpkgs/pkgs/development/ocaml-modules/git-http/default.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ buildDunePackage, git, cohttp, cohttp-lwt }:
-
-buildDunePackage {
-  pname = "git-http";
-  inherit (git) version src minimumOCamlVersion;
-
-  useDune2 = true;
-
-  propagatedBuildInputs = [ git cohttp cohttp-lwt ];
-
-  meta = {
-    description = "Client implementation of the “Smart” HTTP Git protocol in pure OCaml";
-    inherit (git.meta) homepage license maintainers;
-  };
-}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git-unix/default.nix b/nixpkgs/pkgs/development/ocaml-modules/git-unix/default.nix
deleted file mode 100644
index 6ee6ef21c15e..000000000000
--- a/nixpkgs/pkgs/development/ocaml-modules/git-unix/default.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ stdenv, buildDunePackage, git-http, cohttp, cohttp-lwt-unix
-, mmap, cmdliner, mtime, alcotest, mirage-crypto-rng, tls
-, io-page, git-binary
-}:
-
-buildDunePackage {
-  pname = "git-unix";
-  inherit (git-http) version src minimumOCamlVersion;
-
-  useDune2 = true;
-
-  propagatedBuildInputs = [ mmap cmdliner git-http cohttp cohttp-lwt-unix mtime ];
-  checkInputs = [ alcotest mirage-crypto-rng tls io-page git-binary ];
-  doCheck = !stdenv.isAarch64;
-
-  meta = {
-    description = "Unix backend for the Git protocol(s)";
-    inherit (git-http.meta) homepage license maintainers;
-  };
-}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-mirage.nix b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-mirage.nix
new file mode 100644
index 000000000000..d30884006410
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-mirage.nix
@@ -0,0 +1,18 @@
+{ lib, buildDunePackage
+, git, mimic, cohttp-mirage, cohttp, cohttp-lwt
+, fmt, lwt, result, rresult, uri
+}:
+
+buildDunePackage {
+  pname = "git-cohttp-mirage";
+
+  inherit (git) version src minimumOCamlVersion useDune2;
+
+  propagatedBuildInputs = [
+    git mimic cohttp-mirage cohttp cohttp-lwt fmt lwt result rresult uri
+  ];
+
+  meta = git.meta // {
+    description = "A package to use HTTP-based ocaml-git with MirageOS backend";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-unix.nix b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-unix.nix
new file mode 100644
index 000000000000..ac6d423d58ae
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp-unix.nix
@@ -0,0 +1,17 @@
+{ buildDunePackage, git, git-cohttp
+, cohttp-lwt-unix, cohttp-lwt, fmt, lwt, result, rresult, uri
+}:
+
+buildDunePackage {
+  pname = "git-cohttp-unix";
+
+  inherit (git) version src minimumOCamlVersion useDune2;
+
+  propagatedBuildInputs = [
+    git git-cohttp cohttp-lwt-unix cohttp-lwt fmt lwt result rresult uri
+  ];
+
+  meta = git.meta // {
+    description = "A package to use HTTP-based ocaml-git with Unix backend";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git/cohttp.nix b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp.nix
new file mode 100644
index 000000000000..e9126ba4bece
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/git/cohttp.nix
@@ -0,0 +1,19 @@
+{ buildDunePackage, git
+, cohttp, cohttp-lwt, fmt, lwt, result, rresult, uri
+, alcotest, alcotest-lwt, bigstringaf, cstruct, logs
+, mirage-flow, ke
+}:
+
+buildDunePackage rec {
+  pname = "git-cohttp";
+
+  inherit (git) version minimumOCamlVersion src useDune2;
+
+  propagatedBuildInputs = [
+    git cohttp cohttp-lwt fmt lwt result rresult uri
+  ];
+
+  meta = git.meta // {
+    description = "A package to use HTTP-based ocaml-git with Unix backend";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git/default.nix b/nixpkgs/pkgs/development/ocaml-modules/git/default.nix
index f5cb452f1a91..b8d73178d09b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/git/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/git/default.nix
@@ -1,33 +1,40 @@
 { stdenv, lib, fetchurl, buildDunePackage
 , alcotest, mtime, mirage-crypto-rng, tls, git-binary
 , angstrom, astring, cstruct, decompress, digestif, encore, duff, fmt, checkseum
-, fpath, hex, ke, logs, lru, ocaml_lwt, ocamlgraph, ocplib-endian, uri, rresult
-, stdlib-shims
+, fpath, ke, logs, lwt, ocamlgraph, uri, rresult, base64
+, result, bigstringaf, optint, mirage-flow, domain-name, emile
+, mimic, carton, carton-lwt, carton-git, ipaddr, psq, crowbar, alcotest-lwt
 }:
 
 buildDunePackage rec {
   pname = "git";
-  version = "2.1.3";
+  version = "3.3.3";
 
-  minimumOCamlVersion = "4.07";
+  minimumOCamlVersion = "4.08";
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/ocaml-git/releases/download/${version}/git-${version}.tbz";
-    sha256 = "1ppllv65vrkfrmx46aiq5879isffcjmg92z9rv2kh92a83h4lqax";
+    sha256 = "0j8pw9w74bfhrjsqr8zm8g7h1az94z9vg7qgc6z6649zm9yjiax3";
   };
 
+  buildInputs = [
+    base64
+  ];
   propagatedBuildInputs = [
     angstrom astring checkseum cstruct decompress digestif encore duff fmt fpath
-    hex ke logs lru ocaml_lwt ocamlgraph ocplib-endian uri rresult stdlib-shims
+    ke logs lwt ocamlgraph uri rresult result bigstringaf optint mirage-flow
+    domain-name emile mimic carton carton-lwt carton-git ipaddr psq
+  ];
+  checkInputs = [
+    alcotest alcotest-lwt mtime mirage-crypto-rng tls git-binary crowbar
   ];
-  checkInputs = [ alcotest mtime mirage-crypto-rng tls git-binary ];
   doCheck = !stdenv.isAarch64;
 
   meta = {
     description = "Git format and protocol in pure OCaml";
     license = lib.licenses.isc;
-    maintainers = [ lib.maintainers.vbgl ];
+    maintainers = with lib.maintainers; [ sternenseemann vbgl ];
     homepage = "https://github.com/mirage/ocaml-git";
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/git/unix.nix b/nixpkgs/pkgs/development/ocaml-modules/git/unix.nix
new file mode 100644
index 000000000000..f4cea472886d
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/git/unix.nix
@@ -0,0 +1,38 @@
+{ buildDunePackage, git
+, mmap, rresult, result, bigstringaf
+, fmt, bos, fpath, uri, digestif, logs, lwt, git-cohttp-unix
+, mirage-clock, mirage-clock-unix, astring, awa, cmdliner
+, cohttp-lwt-unix, decompress, domain-name, ipaddr, mtime
+, tcpip, awa-mirage, mirage-flow
+, alcotest, alcotest-lwt, base64, cstruct
+, ke, mirage-crypto-rng, ocurl, git-binary
+, ptime
+}:
+
+buildDunePackage {
+  pname = "git-unix";
+  inherit (git) version src minimumOCamlVersion;
+
+  useDune2 = true;
+
+  buildInputs = [
+    awa awa-mirage cmdliner git-cohttp-unix
+    mirage-clock mirage-clock-unix tcpip
+  ];
+  propagatedBuildInputs = [
+    mmap rresult result bigstringaf
+    fmt bos fpath uri digestif logs lwt
+    astring cohttp-lwt-unix decompress
+    domain-name ipaddr mtime mirage-flow
+  ];
+  checkInputs = [
+    alcotest alcotest-lwt base64 cstruct ke
+    mirage-crypto-rng ocurl git-binary ptime
+  ];
+  doCheck = true;
+
+  meta = {
+    description = "Unix backend for the Git protocol(s)";
+    inherit (git.meta) homepage license maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/gnuplot/default.nix b/nixpkgs/pkgs/development/ocaml-modules/gnuplot/default.nix
index d939b884e875..038863aad978 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/gnuplot/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/gnuplot/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "gnuplot";
   version = "0.7";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.03";
 
   src = fetchFromGitHub {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/graphics/default.nix b/nixpkgs/pkgs/development/ocaml-modules/graphics/default.nix
index 6a3217431b43..10d0b4ea6fc7 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/graphics/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/graphics/default.nix
@@ -3,13 +3,13 @@
 buildDunePackage rec {
 
   pname = "graphics";
-  version = "5.1.0";
+  version = "5.1.1";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/ocaml/graphics/releases/download/${version}/graphics-${version}.tbz";
-    sha256 = "16z997mp0ccilaqqvmz3wp7vx0ghaf4ik9qklgd4piklcl1yv5n5";
+    sha256 = "sha256-KGyD497ZKHA2xeXHezmh3P1zoSlre1h5N9zjkAFmMo4=";
   };
 
   buildInputs = [ dune-configurator ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/gsl/default.nix b/nixpkgs/pkgs/development/ocaml-modules/gsl/default.nix
index 046c92afca0a..eacdda27f435 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/gsl/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/gsl/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "gsl";
   version = "1.24.3";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.08";
 
   src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/hidapi/default.nix b/nixpkgs/pkgs/development/ocaml-modules/hidapi/default.nix
index cd95b34fa2bd..0de997881c2c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/hidapi/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/hidapi/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, lib, fetchurl, buildDunePackage, pkg-config
+{ pkgs, lib, fetchurl, buildDunePackage, pkg-config, dune-configurator
 , bigstring,
 }:
 
@@ -6,6 +6,8 @@ buildDunePackage rec {
   pname = "hidapi";
   version = "1.1.1";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/vbmithr/ocaml-hidapi/releases/download/${version}/${pname}-${version}.tbz";
     sha256 = "1j7rd7ajrzla76r3sxljx6fb18f4f4s3jd7vhv59l2ilxyxycai2";
@@ -13,7 +15,7 @@ buildDunePackage rec {
 
   minimumOCamlVersion = "4.03";
 
-  buildInputs = [ pkgs.hidapi pkg-config ];
+  buildInputs = [ pkgs.hidapi pkg-config dune-configurator ];
   propagatedBuildInputs = [ bigstring ];
 
   doCheck = true;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/hxd/default.nix b/nixpkgs/pkgs/development/ocaml-modules/hxd/default.nix
index 1d677ac1a2ef..0775e21b1f8d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/hxd/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/hxd/default.nix
@@ -1,11 +1,11 @@
 { lib, buildDunePackage, fetchurl
-, dune-configurator, cmdliner, angstrom
-, rresult, stdlib-shims, fmt, fpath
+, ocaml, dune-configurator, cmdliner
+, lwt, withLwt ? lib.versionAtLeast ocaml.version "4.07"
 }:
 
 buildDunePackage rec {
   pname = "hxd";
-  version = "0.2.0";
+  version = "0.3.1";
 
   useDune2 = true;
 
@@ -13,24 +13,25 @@ buildDunePackage rec {
 
   src = fetchurl {
     url = "https://github.com/dinosaure/hxd/releases/download/v${version}/hxd-v${version}.tbz";
-    sha256 = "1lyfrq058cc9x0c0hzsf3hv3ys0h8mxkwin9lldidlnj10izqf1l";
+    sha256 = "1c226c91e17cd329dec0c287bfd20f36302aa533069ff9c6ced32721f96b29bc";
   };
 
+  # ignore yes stderr output due to trapped SIGPIPE
+  postPatch = ''
+    sed -i 's|yes ".\+"|& 2> /dev/null|' test/*.t
+  '';
+
   nativeBuildInputs = [
     dune-configurator
   ];
 
+  propagatedBuildInputs = lib.optional withLwt lwt;
+
   buildInputs = [
     cmdliner
-    angstrom
-    rresult
-    fmt
-    fpath
   ];
 
-  propagatedBuildInputs = [
-    stdlib-shims
-  ];
+  doCheck = true;
 
   meta = with lib; {
     description = "Hexdump in OCaml";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/imagelib/default.nix b/nixpkgs/pkgs/development/ocaml-modules/imagelib/default.nix
index 46bd4b962681..0a846214dc05 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/imagelib/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/imagelib/default.nix
@@ -1,30 +1,28 @@
-{ lib, fetchFromGitHub, fetchpatch, buildDunePackage, decompress }:
+{ lib, fetchurl, buildDunePackage
+, decompress, stdlib-shims, alcotest
+}:
 
 buildDunePackage rec {
   minimumOCamlVersion = "4.07";
-  version = "20191011";
+  version = "20210402";
   pname = "imagelib";
 
   useDune2 = true;
 
-  src = fetchFromGitHub {
-    owner = "rlepigre";
-    repo = "ocaml-imagelib";
-    rev = "03fed7733825cef7e0465163f398f6af810e2e75";
-    sha256 = "0h7vgyss42nhlfqpbdnb54nxq86rskqi2ilx8b87r0hi19hqx463";
+  src = fetchurl {
+    url = "https://github.com/rlepigre/ocaml-imagelib/releases/download/${version}/imagelib-${version}.tbz";
+    sha256 = "b3c8ace02b10b36b6c60b3ce3ae0b9109d4a861916ec320c59cc1194f4cc86e3";
   };
 
-  patches = [ (fetchpatch {
-    url = "https://github.com/rlepigre/ocaml-imagelib/pull/24/commits/4704fd44adcda62e0d96ea5b1927071326aa6111.patch";
-    sha256 = "0ipjab1hfa2v2pnd8g1k3q2ia0plgiw7crm3fa4w2aqpzdyabkb9";
-  }) ];
+  propagatedBuildInputs = [ decompress stdlib-shims ];
 
-  propagatedBuildInputs = [ decompress ];
+  doCheck = true;
+  checkInputs = [ alcotest ];
 
   meta = {
     description = "Image formats such as PNG and PPM in OCaml";
     license = lib.licenses.lgpl3;
     maintainers = [ lib.maintainers.vbgl ];
-    inherit (src.meta) homepage;
+    homepage = "https://github.com/rlepigre/ocaml-imagelib";
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/imagelib/unix.nix b/nixpkgs/pkgs/development/ocaml-modules/imagelib/unix.nix
deleted file mode 100644
index a188165a48fa..000000000000
--- a/nixpkgs/pkgs/development/ocaml-modules/imagelib/unix.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ buildDunePackage, imagelib }:
-
-buildDunePackage {
-  pname = "imagelib-unix";
-  inherit (imagelib) version src useDune2 meta;
-
-  propagatedBuildInputs = [ imagelib ];
-}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/index/default.nix b/nixpkgs/pkgs/development/ocaml-modules/index/default.nix
index f4b1844d684c..a24d72a34458 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/index/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/index/default.nix
@@ -1,18 +1,29 @@
-{ lib, fetchurl, buildDunePackage, fmt, logs, mtime, stdlib-shims }:
+{ lib, fetchurl, buildDunePackage
+, repr, ppx_repr, fmt, logs, mtime, stdlib-shims
+, cmdliner, progress, semaphore-compat
+, alcotest, crowbar, re
+}:
 
 buildDunePackage rec {
   pname = "index";
-  version = "1.2.1";
+  version = "1.3.0";
 
-  minimumOCamlVersion = "4.07";
+  minimumOCamlVersion = "4.08";
+
+  useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/index/releases/download/${version}/index-${version}.tbz";
-    sha256 = "1a9b6rsazrjy07syxl9ix5002i95mlvx5vk7nl2x9cs6s0zw906d";
+    sha256 = "00qwhwg79scs5bgp8nbppv06qs9yhicf686q7lh64ngh0642iz6n";
   };
 
   buildInputs = [ stdlib-shims ];
-  propagatedBuildInputs = [ fmt logs mtime ];
+  propagatedBuildInputs = [
+    fmt logs mtime repr ppx_repr cmdliner progress semaphore-compat
+  ];
+
+  doCheck = true;
+  checkInputs = [ alcotest crowbar re ];
 
   meta = {
     homepage = "https://github.com/mirage/index";
@@ -20,5 +31,4 @@ buildDunePackage rec {
     license = lib.licenses.mit;
     maintainers = [ lib.maintainers.vbgl ];
   };
-
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/integers/default.nix b/nixpkgs/pkgs/development/ocaml-modules/integers/default.nix
index ad6f1f9f813d..97443bf5706e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/integers/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/integers/default.nix
@@ -1,9 +1,11 @@
-{ lib, fetchzip, buildDunePackage }:
+{ lib, fetchzip, buildDunePackage, ocaml }:
 
 buildDunePackage rec {
   pname = "integers";
   version = "0.4.0";
 
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
+
   src = fetchzip {
     url = "https://github.com/ocamllabs/ocaml-integers/archive/${version}.tar.gz";
     sha256 = "0yp3ab0ph7mp5741g7333x4nx8djjvxzpnv3zvsndyzcycspn9dd";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/chunk.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/chunk.nix
index 7a2ad0ec7dfd..0014bbbcfcb0 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/chunk.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/chunk.nix
@@ -1,4 +1,4 @@
-{ lib, buildDunePackage, irmin, irmin-mem, irmin-test }:
+{ lib, buildDunePackage, irmin, irmin-test, alcotest }:
 
 buildDunePackage rec {
 
@@ -8,7 +8,7 @@ buildDunePackage rec {
   propagatedBuildInputs = [ irmin ];
 
   doCheck = true;
-  checkInputs = [ irmin-mem irmin-test ];
+  checkInputs = [ alcotest irmin-test ];
 
   meta = irmin.meta // {
     description = "Irmin backend which allow to store values into chunks";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/containers.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/containers.nix
new file mode 100644
index 000000000000..761e9bf5619e
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/containers.nix
@@ -0,0 +1,27 @@
+{ buildDunePackage
+, irmin, irmin-unix, irmin-git, ppx_irmin, lwt, mtime
+, alcotest, alcotest-lwt
+}:
+
+buildDunePackage {
+  pname = "irmin-containers";
+
+  inherit (ppx_irmin) src version useDune2;
+
+  nativeBuildInputs = [
+    ppx_irmin
+  ];
+
+  propagatedBuildInputs = [
+    irmin irmin-unix irmin-git ppx_irmin lwt mtime
+  ];
+
+  doCheck = true;
+  checkInputs = [
+    alcotest alcotest-lwt
+  ];
+
+  meta = ppx_irmin.meta // {
+    description = "Mergeable Irmin data structures";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/default.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/default.nix
index 2e3e27df7ffb..fe13377b3c2b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/default.nix
@@ -1,6 +1,6 @@
-{ lib, fetchurl, buildDunePackage
-, astring, base64, digestif, fmt, jsonm, logs, ocaml_lwt, ocamlgraph, uri
-, alcotest, hex, ppx_irmin
+{ lib, buildDunePackage
+, astring, digestif, fmt, jsonm, logs, ocaml_lwt, ocamlgraph, uri
+, repr, ppx_irmin, bheap
 }:
 
 buildDunePackage {
@@ -11,10 +11,22 @@ buildDunePackage {
   useDune2 = true;
   minimumOCamlVersion = "4.07";
 
-  propagatedBuildInputs = [ astring base64 digestif fmt jsonm logs ocaml_lwt ocamlgraph uri ];
+  propagatedBuildInputs = [
+    astring
+    digestif
+    fmt
+    jsonm
+    logs
+    ocaml_lwt
+    ocamlgraph
+    uri
+    repr
+    bheap
+    ppx_irmin
+  ];
 
-  checkInputs = [ alcotest hex ppx_irmin ];
-  doCheck = true;
+  # circular dependency on irmin-mem
+  doCheck = false;
 
   meta = ppx_irmin.meta // {
     description = "A distributed database built on the same principles as Git";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/git.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/git.nix
index b222bc53e3a2..a6c1e8af8fa4 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/git.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/git.nix
@@ -1,6 +1,10 @@
-{ lib, buildDunePackage, git, irmin, irmin-mem, irmin-test, git-unix }:
+{ lib, buildDunePackage
+, git, irmin, irmin-test, ppx_irmin, git-cohttp-unix, git-unix
+, digestif, cstruct, fmt, astring, fpath, logs, lwt, uri
+, mtime, alcotest
+}:
 
-buildDunePackage rec {
+buildDunePackage {
 
   pname = "irmin-git";
 
@@ -8,9 +12,21 @@ buildDunePackage rec {
 
   useDune2 = true;
 
-  propagatedBuildInputs = [ git irmin ];
-
-  checkInputs = lib.optionals doCheck [ git-unix irmin-mem irmin-test ];
+  propagatedBuildInputs = [
+    git
+    irmin
+    ppx_irmin
+    digestif
+    cstruct
+    fmt
+    astring
+    fpath
+    logs
+    lwt
+    uri
+  ];
+
+  checkInputs = [ mtime alcotest git-cohttp-unix git-unix irmin-test ];
 
   doCheck = true;
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/graphql.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/graphql.nix
index 6e4598dd986a..ca205cac4e15 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/graphql.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/graphql.nix
@@ -1,4 +1,6 @@
-{ lib, buildDunePackage, cohttp-lwt, graphql-cohttp, graphql-lwt, irmin }:
+{ lib, buildDunePackage, cohttp-lwt, graphql-cohttp, graphql-lwt, irmin
+, alcotest, alcotest-lwt, logs, yojson, cohttp-lwt-unix
+}:
 
 buildDunePackage rec {
 
@@ -10,8 +12,14 @@ buildDunePackage rec {
 
   propagatedBuildInputs = [ cohttp-lwt graphql-cohttp graphql-lwt irmin ];
 
-  # test requires network
-  doCheck = false;
+  doCheck = true;
+  checkInputs = [
+    alcotest
+    alcotest-lwt
+    logs
+    cohttp-lwt-unix
+    yojson
+  ];
 
   meta = irmin.meta // {
     description = "GraphQL server for Irmin";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/http.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/http.nix
index 24e9f52aa086..b50e0b873454 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/http.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/http.nix
@@ -1,5 +1,5 @@
 { lib, buildDunePackage, cohttp-lwt, irmin, webmachine
-, checkseum, git-unix, irmin-git, irmin-mem, irmin-test
+, checkseum, git-unix, irmin-git, irmin-test, digestif, git-cohttp-unix
 }:
 
 buildDunePackage rec {
@@ -12,7 +12,7 @@ buildDunePackage rec {
 
   propagatedBuildInputs = [ cohttp-lwt irmin webmachine ];
 
-  checkInputs = lib.optionals doCheck [ checkseum git-unix irmin-git irmin-mem irmin-test ];
+  checkInputs = [ digestif checkseum git-cohttp-unix git-unix irmin-git irmin-test ];
 
   doCheck = true;
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/layers.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/layers.nix
new file mode 100644
index 000000000000..40410b004ae7
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/layers.nix
@@ -0,0 +1,18 @@
+{ buildDunePackage, irmin, mtime, logs, lwt }:
+
+buildDunePackage {
+  pname = "irmin-layers";
+
+  inherit (irmin) version src useDune2;
+
+  propagatedBuildInputs = [
+    irmin
+    mtime
+    logs
+    lwt
+  ];
+
+  meta = irmin.meta // {
+    description = "Combine different Irmin stores into a single, layered store";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/mem.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/mem.nix
deleted file mode 100644
index 1b8947849a92..000000000000
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/mem.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{ lib, buildDunePackage, irmin, irmin-test }:
-
-buildDunePackage rec {
-
-  pname = "irmin-mem";
-
-  inherit (irmin) version src;
-
-  useDune2 = true;
-
-  propagatedBuildInputs = [ irmin ];
-
-  checkInputs = lib.optional doCheck irmin-test;
-
-  doCheck = true;
-
-  meta = irmin.meta // {
-    description = "Generic in-memory Irmin stores";
-  };
-
-}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-git.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-git.nix
new file mode 100644
index 000000000000..dfa84ff2335d
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-git.nix
@@ -0,0 +1,27 @@
+{ buildDunePackage, irmin-mirage, irmin-git
+, mirage-kv, cohttp, conduit-lwt, conduit-mirage
+, git-cohttp-mirage, fmt, git, lwt, mirage-clock, uri
+}:
+
+buildDunePackage {
+  pname = "irmin-mirage-git";
+
+  inherit (irmin-mirage) version src useDune2;
+
+  propagatedBuildInputs = [
+    irmin-mirage
+    irmin-git
+    mirage-kv
+    cohttp
+    conduit-lwt
+    conduit-mirage
+    git-cohttp-mirage
+    fmt
+    git
+    lwt
+    mirage-clock
+    uri
+  ];
+
+  inherit (irmin-mirage) meta;
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-graphql.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-graphql.nix
new file mode 100644
index 000000000000..d550b9c924b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage-graphql.nix
@@ -0,0 +1,21 @@
+{ buildDunePackage, irmin-mirage, irmin-graphql
+, mirage-clock, cohttp-lwt, lwt, uri, git
+}:
+
+buildDunePackage {
+  pname = "irmin-mirage-graphql";
+
+  inherit (irmin-mirage) version src useDune2;
+
+  propagatedBuildInputs = [
+    irmin-mirage
+    irmin-graphql
+    mirage-clock
+    cohttp-lwt
+    lwt
+    uri
+    git
+  ];
+
+  inherit (irmin-mirage) meta;
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage.nix
new file mode 100644
index 000000000000..675c8a3fdd28
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/mirage.nix
@@ -0,0 +1,15 @@
+{ buildDunePackage, irmin, fmt, ptime, mirage-clock }:
+
+buildDunePackage {
+  pname = "irmin-mirage";
+
+  inherit (irmin) version src useDune2;
+
+  propagatedBuildInputs = [
+    irmin fmt ptime mirage-clock
+  ];
+
+  meta = irmin.meta // {
+    description = "MirageOS-compatible Irmin stores";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/pack.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/pack.nix
index b0081eb366e4..16ef675c1f8c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/pack.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/pack.nix
@@ -1,4 +1,6 @@
-{ lib, buildDunePackage, alcotest-lwt, index, irmin, irmin-test, ocaml_lwt }:
+{ lib, buildDunePackage
+, alcotest-lwt, index, irmin, irmin-layers, irmin-test, ocaml_lwt, fpath
+}:
 
 buildDunePackage rec {
   minimumOCamlVersion = "4.02.3";
@@ -9,9 +11,10 @@ buildDunePackage rec {
 
   useDune2 = true;
 
-  propagatedBuildInputs = [ index irmin ocaml_lwt ];
+  buildInputs = [ fpath ];
+  propagatedBuildInputs = [ index irmin irmin-layers ocaml_lwt ];
 
-  checkInputs = lib.optionals doCheck [ alcotest-lwt irmin-test ];
+  checkInputs = [ alcotest-lwt irmin-test ];
 
   doCheck = true;
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/ppx.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/ppx.nix
index 35aa659fbc8a..1d605763ab52 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/ppx.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/ppx.nix
@@ -1,29 +1,27 @@
-{ lib, fetchurl, buildDunePackage, ppxlib, ocaml-syntax-shims }:
+{ lib, fetchurl, buildDunePackage, ppxlib, ppx_repr }:
 
 buildDunePackage rec {
   pname = "ppx_irmin";
-  version = "2.2.0";
+  version = "2.5.1";
 
   src = fetchurl {
     url = "https://github.com/mirage/irmin/releases/download/${version}/irmin-${version}.tbz";
-    sha256 = "0gzw918b661qkvd140hilww9jsc49rxsxz1k4iihyvikjn202km4";
+    sha256 = "131pcgmpys6danprcbxzf4pdsl0ka74bpmmxz8db4507cvxhsz3n";
   };
 
-  minimumOCamlVersion = "4.06";
+  minimumOCamlVersion = "4.08";
 
   useDune2 = true;
 
-  buildInputs = [ ocaml-syntax-shims ];
-  propagatedBuildInputs = [ ppxlib ];
-
-  # tests depend on irmin, would create mutual dependency
-  # opt to test irmin instead of ppx_irmin
-  doCheck = false;
+  propagatedBuildInputs = [
+    ppx_repr
+    ppxlib
+  ];
 
   meta = {
     homepage = "https://irmin.org/";
     description = "PPX deriver for Irmin generics";
     license = lib.licenses.isc;
-    maintainers = [ lib.maintainers.vbgl ];
+    maintainers = with lib.maintainers; [ vbgl sternenseemann ];
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/test.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/test.nix
index b8a3f3ae2457..90141d925e6f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/test.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/test.nix
@@ -1,4 +1,6 @@
-{ buildDunePackage, alcotest, cmdliner, irmin, metrics-unix, mtime }:
+{ buildDunePackage
+, alcotest, cmdliner, irmin, metrics-unix, mtime, irmin-layers
+}:
 
 buildDunePackage {
 
@@ -8,7 +10,9 @@ buildDunePackage {
 
   useDune2 = true;
 
-  propagatedBuildInputs = [ alcotest cmdliner irmin metrics-unix mtime ];
+  propagatedBuildInputs = [
+    alcotest cmdliner irmin metrics-unix mtime irmin-layers
+  ];
 
   meta = irmin.meta // {
     description = "Irmin test suite";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/irmin/unix.nix b/nixpkgs/pkgs/development/ocaml-modules/irmin/unix.nix
index 7a09eaabd3ec..a3dfb5d508c2 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/irmin/unix.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/irmin/unix.nix
@@ -1,7 +1,7 @@
 { lib, buildDunePackage
-, checkseum, cmdliner, git-unix, yaml
-, irmin, irmin-fs, irmin-git, irmin-graphql, irmin-http, irmin-mem, irmin-pack, irmin-watcher
-, irmin-test
+, checkseum, cmdliner, git-unix, git-cohttp-unix, yaml, fpath
+, irmin, irmin-fs, irmin-git, irmin-graphql, irmin-http
+, irmin-pack, irmin-watcher, irmin-test
 }:
 
 buildDunePackage rec {
@@ -12,8 +12,10 @@ buildDunePackage rec {
 
   useDune2 = true;
 
-  propagatedBuildInputs = [ checkseum cmdliner git-unix yaml
-    irmin irmin-fs irmin-git irmin-graphql irmin-http irmin-mem irmin-pack irmin-watcher
+  propagatedBuildInputs = [
+    checkseum cmdliner git-unix yaml fpath
+    irmin irmin-fs irmin-git irmin-graphql irmin-http
+    irmin-pack irmin-watcher git-cohttp-unix
   ];
 
   checkInputs = lib.optional doCheck irmin-test;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.12.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.12.nix
index 4585a3b8596c..295960764dc5 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.12.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.12.nix
@@ -382,7 +382,12 @@ rec {
   async_ssl = janePackage {
     pname = "async_ssl";
     hash = "02ard8x5q5c42d9jdqmyzfx624yjq8cxxmvq3zb82hf6p8cc57ml";
-    meta.description = "An Async-pipe-based interface with OpenSSL";
+    meta = {
+      description = "An Async-pipe-based interface with OpenSSL";
+      # ctypes no longer works with dune 1
+      # dune 2 no longer supports jbuild
+      broken = true;
+    };
     propagatedBuildInputs = [ async ctypes openssl ];
   };
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.14.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.14.nix
index 29b18e0bf980..738828e83086 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.14.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/0.14.nix
@@ -147,6 +147,11 @@ rec {
     meta.description = "Async wrappers for SSL";
     buildInputs = [ dune-configurator ];
     propagatedBuildInputs = [ async ctypes openssl ];
+    # in ctypes.foreign 0.18.0 threaded and unthreaded have been merged
+    postPatch = ''
+      substituteInPlace bindings/dune \
+        --replace "ctypes.foreign.threaded" "ctypes.foreign"
+    '';
   };
 
   async_unix = janePackage {
@@ -158,7 +163,8 @@ rec {
 
   base = janePackage {
     pname = "base";
-    hash = "1d5ynzzq58g9qammhba5dasrg734p9vndq28a7kg80bdxb8gh3kp";
+    version = "0.14.1";
+    hash = "1hizjxmiqlj2zzkwplzjamw9rbnl0kh44sxgjpzdij99qnfkzylf";
     minimumOCamlVersion = "4.07";
     meta.description = "Full standard library replacement for OCaml";
     buildInputs = [ dune-configurator ];
@@ -176,7 +182,8 @@ rec {
 
   base_quickcheck = janePackage {
     pname = "base_quickcheck";
-    hash = "1lmp1h68g0gqiw8m6gqcbrp0fn76nsrlsqrwxp20d7jhh0693f3j";
+    version = "0.14.1";
+    hash = "0apq3d9xb0zdaqsl4cjk5skyig57ff1plndb2mh0nn3czvfhifxs";
     minimumOCamlVersion = "4.04.2";
     meta.description = "Randomized testing framework, designed for compatibility with Base";
     propagatedBuildInputs = [ ppx_base ppx_fields_conv ppx_let ppx_sexp_value splittable_random ];
@@ -216,7 +223,8 @@ rec {
 
   core = janePackage {
     pname = "core";
-    hash = "1m9h73pk9590m8ngs1yf4xrw61maiqmi9glmlrl12qhi0wcja5f3";
+    version = "0.14.1";
+    hash = "1isrcl07nkmdm6akqsqs9z8s6zvva2lvg47kaagy7gsbyszrqb82";
     meta.description = "System-independent part of Core";
     buildInputs = [ jst-config ];
     propagatedBuildInputs = [ core_kernel spawn timezone ];
@@ -239,7 +247,8 @@ rec {
 
   core_kernel = janePackage {
     pname = "core_kernel";
-    hash = "012sp02v35j41lzkvf073620602fgiswz2n224j06mk3bm8jmjms";
+    version = "0.14.1";
+    hash = "0pikg4ln6177gbs0jfix7xj50zlcm7058h64lxnd7wspnj7mq8sd";
     meta.description = "System-independent part of Core";
     buildInputs = [ jst-config ];
     propagatedBuildInputs = [ base_bigstring sexplib ];
@@ -442,7 +451,8 @@ rec {
 
   ppx_custom_printf = janePackage {
     pname = "ppx_custom_printf";
-    hash = "0p9hgx0krxqw8hlzfv2bg2m3zi5nxsnzhyp0fj5936rapad02hc5";
+    version = "0.14.1";
+    hash = "0c1m65kn27zvwmfwy7kk46ga76yw2a3ik9jygpy1b6nn6pi026w9";
     minimumOCamlVersion = "4.04.2";
     meta.description = "Printf-style format-strings for user-defined string conversion";
     propagatedBuildInputs = [ ppx_sexp_conv ];
@@ -458,7 +468,8 @@ rec {
 
   ppx_expect = janePackage {
     pname = "ppx_expect";
-    hash = "05v6jzn1nbmwk3vzxxnb3380wzg2nb28jpb3v5m5c4ikn0jrhcwn";
+    version = "0.14.1";
+    hash = "0vbbnjrzpyk5p0js21lafr6fcp2wqka89p1876rdf472cmg0l7fv";
     minimumOCamlVersion = "4.04.2";
     meta.description = "Cram like framework for OCaml";
     propagatedBuildInputs = [ ppx_here ppx_inline_test re ];
@@ -533,6 +544,14 @@ rec {
     propagatedBuildInputs = [ ppxlib ];
   };
 
+  ppx_log = janePackage {
+    pname = "ppx_log";
+    hash = "10hnr5lpww3fw0bnidzngalbgy0j1wvz1g5ki9c9h558pnpvsazr";
+    minimumOCamlVersion = "4.08.0";
+    meta.description = "Ppx_sexp_message-like extension nodes for lazily rendering log messages";
+    propagatedBuildInputs = [ async_unix ppx_jane sexplib ];
+  };
+
   ppx_module_timer = janePackage {
     pname = "ppx_module_timer";
     hash = "163q1rpblwv82fxwyf0p4j9zpsj0jzvkfmzb03r0l49gqhn89mp6";
@@ -543,7 +562,8 @@ rec {
 
   ppx_optcomp = janePackage {
     pname = "ppx_optcomp";
-    hash = "1wav3zgh4244x1ll562g735cwwrzyk5jj72niq9jgz9qjlpsprlk";
+    version = "0.14.1";
+    hash = "0j5smqa0hig1yn8wfrb4mv0y59kkwsalmqkm5asbd7kcc6589ap4";
     minimumOCamlVersion = "4.04.2";
     meta.description = "Optional compilation for OCaml";
     propagatedBuildInputs = [ ppxlib ];
@@ -575,16 +595,17 @@ rec {
 
   ppx_sexp_conv = janePackage {
     pname = "ppx_sexp_conv";
-    version = "0.14.1";
+    version = "0.14.3";
     minimumOCamlVersion = "4.04.2";
-    hash = "04bx5id99clrgvkg122nx03zig1m7igg75piphhyx04w33shgkz2";
+    hash = "0dbri9d00ydi0dw1cavswnqdmhjaaz80vap29ns2lr6mhhlvyjmj";
     meta.description = "[@@deriving] plugin to generate S-expression conversion functions";
     propagatedBuildInputs = [ ppxlib sexplib0 base ];
   };
 
   ppx_sexp_message = janePackage {
     pname = "ppx_sexp_message";
-    hash = "17xnq345xwfkl9ydn05ljsg37m2glh3alnspayl3fgbhmcjmav3i";
+    version = "0.14.1";
+    hash = "1lvsr0d68kakih1ll33hy6dxbjkly6lmky4q6z0h0hrcbd6z48k4";
     minimumOCamlVersion = "4.04.2";
     meta.description = "A ppx rewriter for easy construction of s-expressions";
     propagatedBuildInputs = [ ppx_here ppx_sexp_conv ];
@@ -618,9 +639,9 @@ rec {
 
   ppx_typerep_conv = janePackage {
     pname = "ppx_typerep_conv";
-    version = "0.14.1";
+    version = "0.14.2";
     minimumOCamlVersion = "4.04.2";
-    hash = "1r0z7qlcpaicas5hkymy2q0gi207814wlay4hys7pl5asd59wcdh";
+    hash = "0yk9vkpnwr8labgfncqdi4rfkj88d8mb3cr8m4gdqpi3f2r27hf0";
     meta.description = "Generation of runtime types from type declarations";
     propagatedBuildInputs = [ ppxlib typerep ];
   };
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/default.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/default.nix
index 25b498bb7da0..a4c026ffb8b2 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/default.nix
@@ -417,7 +417,12 @@ rec {
     pname = "async_ssl";
     hash = "1p83fzfla4rb820irdrz3f2hp8kq5zrhw47rqmfv6qydlca1bq64";
     propagatedBuildInputs = [ async ctypes openssl ];
-    meta.description = "Async wrappers for SSL";
+    meta = {
+      description = "Async wrappers for SSL";
+      # ctypes no longer works with dune 1
+      # dune 2 no longer supports jbuild
+      broken = true;
+    };
   };
 
   sexp_pretty = janePackage {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix
index 0dd0dde6ec9e..9a67db4966ce 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix
@@ -14,6 +14,8 @@ buildDunePackage (args // {
     sha256 = hash;
   };
 
-  meta.license = lib.licenses.asl20;
-  meta.homepage = "https://github.com/janestreet/${pname}";
+  meta = {
+    license = lib.licenses.asl20;
+    homepage = "https://github.com/janestreet/${pname}";
+  } // args.meta;
 })
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
index 5b7d9c3210d4..6c7d746e9481 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
@@ -14,6 +14,8 @@ buildDunePackage (args // {
     sha256 = hash;
   };
 
-  meta.license = lib.licenses.mit;
-  meta.homepage = "https://github.com/janestreet/${pname}";
+  meta = {
+    license = lib.licenses.mit;
+    homepage = "https://github.com/janestreet/${pname}";
+  } // args.meta;
 })
diff --git a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
index 9675c8d019a0..1ed2e6bc4f20 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
@@ -22,6 +22,8 @@ buildDunePackage (args // {
 
   inherit doCheck;
 
-  meta.license = lib.licenses.mit;
-  meta.homepage = "https://github.com/janestreet/${pname}";
+  meta = {
+    license = lib.licenses.mit;
+    homepage = "https://github.com/janestreet/${pname}";
+  } // args.meta;
 })
diff --git a/nixpkgs/pkgs/development/ocaml-modules/labltk/default.nix b/nixpkgs/pkgs/development/ocaml-modules/labltk/default.nix
index 65ea4d4b82ec..3ee09b2d51c9 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/labltk/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/labltk/default.nix
@@ -56,6 +56,10 @@ let param =
     version = "8.06.9";
     sha256 = "1k42k3bjkf22gk39lwwzqzfhgjyhxnclslldrzpg5qy1829pbnc0";
   };
+  "4.12" = mkNewParam {
+    version = "8.06.10";
+    sha256 = "06cck7wijq4zdshzhxm6jyl8k3j0zglj2axsyfk6q1sq754zyf4a";
+  };
 }.${builtins.substring 0 4 ocaml.version};
 in
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/linenoise/default.nix b/nixpkgs/pkgs/development/ocaml-modules/linenoise/default.nix
index dd5504dda5ca..eaeb053239e8 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/linenoise/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/linenoise/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "linenoise";
   version = "1.3.0";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.02";
 
   src = fetchFromGitHub {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/lru/default.nix b/nixpkgs/pkgs/development/ocaml-modules/lru/default.nix
index e5c7937b27a4..035d612cfe27 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/lru/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/lru/default.nix
@@ -1,9 +1,11 @@
-{ lib, fetchurl, buildDunePackage, psq }:
+{ lib, fetchurl, buildDunePackage, ocaml, psq, qcheck-alcotest }:
 
 buildDunePackage rec {
   pname = "lru";
   version = "0.3.0";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/pqwy/lru/releases/download/v${version}/lru-v${version}.tbz";
     sha256 = "1ab9rd7cq15ml8x0wjl44wy99h5z7x4g9vkkz4i2d7n84ghy7vw4";
@@ -11,6 +13,9 @@ buildDunePackage rec {
 
   propagatedBuildInputs = [ psq ];
 
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ qcheck-alcotest ];
+
   meta = {
     homepage = "https://github.com/pqwy/lru";
     description = "Scalable LRU caches for OCaml";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/luv/default.nix b/nixpkgs/pkgs/development/ocaml-modules/luv/default.nix
new file mode 100644
index 000000000000..6ad5ce5d4879
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/luv/default.nix
@@ -0,0 +1,35 @@
+{ lib, buildDunePackage, fetchurl
+, ctypes, result
+, alcotest
+, file
+}:
+
+buildDunePackage rec {
+  pname = "luv";
+  version = "0.5.7";
+  useDune2 = true;
+
+  src = fetchurl {
+    url = "https://github.com/aantron/luv/releases/download/${version}/luv-${version}.tar.gz";
+    sha256 = "0wjnw5riydnzsk1xdzljlpzdnjwpa0j597y6x6ma4990mqj54260";
+  };
+
+  postConfigure = ''
+    for f in src/c/vendor/configure/{ltmain.sh,configure}; do
+      substituteInPlace "$f" --replace /usr/bin/file file
+    done
+  '';
+
+  nativeBuildInputs = [ file ];
+  propagatedBuildInputs = [ ctypes result ];
+  checkInputs = [ alcotest ];
+  doCheck = true;
+
+  meta = with lib; {
+    homepage = "https://github.com/aantron/luv";
+    description = "Binding to libuv: cross-platform asynchronous I/O";
+    # MIT-licensed, extra licenses apply partially to libuv vendor
+    license = with licenses; [ mit bsd2 bsd3 cc-by-sa-40 ];
+    maintainers = with maintainers; [ locallycompact sternenseemann ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mariadb/default.nix b/nixpkgs/pkgs/development/ocaml-modules/mariadb/default.nix
index ed3e5999b416..2c3c7c423ac0 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mariadb/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mariadb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, buildOasisPackage
+{ lib, fetchFromGitHub, buildOasisPackage
 , ctypes, mariadb, libmysqlclient }:
 
 buildOasisPackage rec {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/merlin-extend/default.nix b/nixpkgs/pkgs/development/ocaml-modules/merlin-extend/default.nix
index 752fbc039fa2..6d4fcad09775 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/merlin-extend/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/merlin-extend/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "merlin-extend";
   version = "0.6";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/let-def/merlin-extend/releases/download/v${version}/merlin-extend-v${version}.tbz";
     sha256 = "0hvc4mz92x3rl2dxwrhvhzwl4gilnyvvwcqgr45vmdpyjyp3dwn2";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mimic/default.nix b/nixpkgs/pkgs/development/ocaml-modules/mimic/default.nix
index 01b2c813f2f8..3ddae57e9e8d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mimic/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mimic/default.nix
@@ -5,14 +5,14 @@
 
 buildDunePackage rec {
   pname = "mimic";
-  version = "0.0.1";
+  version = "0.0.2";
 
   minimumOCamlVersion = "4.08";
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/ocaml-git/releases/download/${pname}-v${version}/${pname}-${pname}-v${version}.tbz";
-    sha256 = "0j4l99sgm5mdmv67vakkz2pw45l6i89bpza88xqkgmskfk50c5pk";
+    sha256 = "3ad5af3caa1120ecfdf022de41ba5be8edfbf50270fc99238b82d3d2d6e7c317";
   };
 
   # don't install changelogs for other packages
@@ -25,7 +25,6 @@ buildDunePackage rec {
     mirage-flow
     result
     rresult
-    cstruct
     logs
   ];
 
@@ -35,6 +34,7 @@ buildDunePackage rec {
     alcotest-lwt
     bigstringaf
     bigarray-compat
+    cstruct
     ke
   ];
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/minisat/default.nix b/nixpkgs/pkgs/development/ocaml-modules/minisat/default.nix
index 9a02f57cc385..f9d37d6b4faf 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/minisat/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/minisat/default.nix
@@ -2,15 +2,17 @@
 
 buildDunePackage rec {
   pname = "minisat";
-  version = "0.2";
+  version = "0.3";
+
+  useDune2 = true;
 
   minimumOCamlVersion = "4.05";
 
   src = fetchFromGitHub {
     owner  = "c-cube";
     repo   = "ocaml-minisat";
-    rev    = version;
-    sha256 = "1jibylmb1ww0x42n6wl8bdwicaysgxp0ag244x7w5m3jifq3xs6q";
+    rev    = "v${version}";
+    sha256 = "01wggbziqz5x6d7mwdl40sbf6qal7fd853b224zjf9n0kzzsnczh";
   };
 
   meta = {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/default.nix b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/default.nix
index 77d6b4ef7788..de8cfd311e54 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/default.nix
@@ -4,6 +4,10 @@ buildDunePackage rec {
   pname = "mirage-clock";
   version = "3.1.0";
 
+  useDune2 = true;
+
+  minimumOCamlVersion = "4.06";
+
   src = fetchurl {
     url = "https://github.com/mirage/mirage-clock/releases/download/v${version}/mirage-clock-v${version}.tbz";
     sha256 = "0cqa07aqkamw0dvis1fl46brvk81zvb92iy5076ik62gv9n5a0mn";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/freestanding.nix b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/freestanding.nix
new file mode 100644
index 000000000000..ef278f1cd25b
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/freestanding.nix
@@ -0,0 +1,23 @@
+{ lib
+, buildDunePackage
+, mirage-clock
+}:
+
+buildDunePackage {
+  pname = "mirage-clock-freestanding";
+
+  inherit (mirage-clock)
+    version
+    src
+    useDune2
+    minimumOCamlVersion
+    ;
+
+  propagatedBuildInputs = [
+    mirage-clock
+  ];
+
+  meta = mirage-clock.meta // {
+    description = "Paravirtual implementation of the MirageOS Clock interface";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/unix.nix b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/unix.nix
index 5918d89221f2..355cffaaa157 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/unix.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mirage-clock/unix.nix
@@ -1,9 +1,11 @@
-{ buildDunePackage, mirage-clock }:
+{ buildDunePackage, mirage-clock, dune-configurator }:
 
 buildDunePackage {
   pname = "mirage-clock-unix";
 
-  inherit (mirage-clock) version src;
+  inherit (mirage-clock) version useDune2 src;
+
+  buildInputs = [ dune-configurator ];
 
   propagatedBuildInputs = [ mirage-clock ];
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/default.nix b/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/default.nix
index ab48e01950e6..3265413d98fa 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/default.nix
@@ -1,14 +1,17 @@
-{ lib, fetchurl, buildDunePackage, ounit, cstruct, dune-configurator, eqaf, pkg-config }:
+{ lib, fetchurl, buildDunePackage, ounit, cstruct, dune-configurator, eqaf, pkg-config
+, withFreestanding ? false
+, ocaml-freestanding
+}:
 
 buildDunePackage rec {
   minimumOCamlVersion = "4.08";
 
   pname = "mirage-crypto";
-  version = "0.8.10";
+  version = "0.9.1";
 
   src = fetchurl {
     url = "https://github.com/mirage/mirage-crypto/releases/download/v${version}/mirage-crypto-v${version}.tbz";
-    sha256 = "8a5976fe7837491d2fbd1917b77524776f70ae590e9f55cf757cc8951b5481fc";
+    sha256 = "53e0ae90f19651ab7f09156557ea5ec07bce7a52468ec6687471e0333f3e2133";
   };
 
   useDune2 = true;
@@ -17,12 +20,20 @@ buildDunePackage rec {
   checkInputs = [ ounit ];
 
   nativeBuildInputs = [ dune-configurator pkg-config ];
-  propagatedBuildInputs = [ cstruct eqaf ];
+  propagatedBuildInputs = [
+    cstruct eqaf
+  ] ++ lib.optionals withFreestanding [
+    ocaml-freestanding
+  ];
 
   meta = with lib; {
     homepage = "https://github.com/mirage/mirage-crypto";
     description = "Simple symmetric cryptography for the modern age";
-    license = licenses.isc;
+    license = [
+      licenses.isc  # default license
+      licenses.bsd2 # mirage-crypto-rng-mirage
+      licenses.mit  # mirage-crypto-ec
+    ];
     maintainers = with maintainers; [ sternenseemann ];
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/ec.nix b/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/ec.nix
new file mode 100644
index 000000000000..bcd7a1f04f25
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/mirage-crypto/ec.nix
@@ -0,0 +1,55 @@
+{ lib
+, buildDunePackage
+, mirage-crypto
+, dune-configurator
+, pkg-config
+, cstruct
+, mirage-crypto-rng
+, mirage-crypto-pk
+, hex
+, alcotest
+, asn1-combinators
+, ppx_deriving_yojson
+, ppx_deriving
+, yojson
+, withFreestanding ? false
+, ocaml-freestanding
+}:
+
+buildDunePackage {
+  pname = "mirage-crypto-ec";
+
+  inherit (mirage-crypto)
+    minimumOCamlVersion
+    src
+    version
+    useDune2
+    ;
+
+  nativeBuildInputs = [
+    pkg-config
+    dune-configurator
+  ];
+  propagatedBuildInputs = [
+    cstruct
+    mirage-crypto
+    mirage-crypto-rng
+  ] ++ lib.optionals withFreestanding [
+    ocaml-freestanding
+  ];
+
+  doCheck = true;
+  checkInputs = [
+    hex
+    alcotest
+    asn1-combinators
+    ppx_deriving_yojson
+    ppx_deriving
+    yojson
+    mirage-crypto-pk
+  ];
+
+  meta = mirage-crypto.meta // {
+    description = "Elliptic Curve Cryptography with primitives taken from Fiat";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/mmap/default.nix b/nixpkgs/pkgs/development/ocaml-modules/mmap/default.nix
index 8ae1f4a9d47c..b13639150b0d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/mmap/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/mmap/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "mmap";
   version = "1.1.0";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/mirage/mmap/releases/download/v${version}/mmap-v${version}.tbz";
     sha256 = "0l6waidal2n8mkdn74avbslvc10sf49f5d889n838z03pra5chsc";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/npy/default.nix b/nixpkgs/pkgs/development/ocaml-modules/npy/default.nix
index 87fd72b7567a..5ba6cb08cc66 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/npy/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/npy/default.nix
@@ -2,15 +2,17 @@
 
 buildDunePackage rec {
   pname = "npy";
-  version = "unstable-2019-04-02";
+  version = "0.0.9";
+
+  useDune2 = true;
 
   minimumOCamlVersion = "4.06";
 
   src = fetchFromGitHub {
     owner = "LaurentMazare";
     repo   = "${pname}-ocaml";
-    rev    = "c051086bfea6bee58208098bcf1c2f725a80a1fb";
-    sha256 = "06mgrnm7xiw2lhqvbdv2zmd65sqfdnjd7j4qmcswanmplm17yhvb";
+    rev    = version;
+    sha256 = "1fryglkm20h6kdqjl55b7065b34bdg3g3p6j0jv33zvd1m5888m1";
   };
 
   propagatedBuildInputs = [ camlzip ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-cairo/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
index 49c8fe5470b6..7d2960fc5a66 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
 
   patches = [ ./META.patch ];
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml automake gnum4 autoconf unzip
+  nativeBuildInputs = [ pkg-config unzip ];
+  buildInputs = [ ocaml automake gnum4 autoconf
                   findlib freetype lablgtk cairo gdk-pixbuf gtk2 pango ];
 
   createFindlibDestdir = true;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/configurable-binding.patch b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/configurable-binding.patch
new file mode 100644
index 000000000000..25a7b92f01fc
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/configurable-binding.patch
@@ -0,0 +1,49 @@
+commit b273c9f7ab10475787db4d6e09bd4b71b374d0ec
+Author: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>
+Date:   Thu Mar 18 01:28:46 2021 +0100
+
+    Let user specify solo5-binding to use
+    
+    This is a little feature for the configure script I wanted to have for
+    the NixOS package: It allows the user to set PKG_CONFIG_DEPS before
+    running configure.sh to disable the autodetection mechanism. This is
+    useful for NixOS as we have all bindings bundled in the solo5 package,
+    so the result would also be solo5-bindings-xen. Additionally, it allows
+    us to do the binding selection declaratively and minimize the risk of
+    accidentally switching backend.
+    
+    PKG_CONFIG_DEPS seems like a bit of an unappropriate variable name for a
+    user “interface”, let me know if you want a dedicated environment
+    variable for this in case there will be more PKG_CONFIG_DEPS.
+
+diff --git a/configure.sh b/configure.sh
+index c254f7b..c675a02 100755
+--- a/configure.sh
++++ b/configure.sh
+@@ -11,13 +11,19 @@ if pkg_exists solo5-bindings-hvt solo5-bindings-spt solo5-bindings-virtio solo5-
+     echo "ERROR: Only one of solo5-bindings-hvt, solo5-bindings-spt, solo5-bindings-virtio, solo5-bindings-muen, solo5-bindings-genode, solo5-bindings-xen can be installed." 1>&2
+     exit 1
+ fi
+-PKG_CONFIG_DEPS=
+-pkg_exists solo5-bindings-hvt && PKG_CONFIG_DEPS=solo5-bindings-hvt
+-pkg_exists solo5-bindings-spt && PKG_CONFIG_DEPS=solo5-bindings-spt
+-pkg_exists solo5-bindings-muen && PKG_CONFIG_DEPS=solo5-bindings-muen
+-pkg_exists solo5-bindings-virtio && PKG_CONFIG_DEPS=solo5-bindings-virtio
+-pkg_exists solo5-bindings-genode && PKG_CONFIG_DEPS=solo5-bindings-genode
+-pkg_exists solo5-bindings-xen && PKG_CONFIG_DEPS=solo5-bindings-xen
++if [ -z "${PKG_CONFIG_DEPS}" ]; then
++    PKG_CONFIG_DEPS=
++    pkg_exists solo5-bindings-hvt && PKG_CONFIG_DEPS=solo5-bindings-hvt
++    pkg_exists solo5-bindings-spt && PKG_CONFIG_DEPS=solo5-bindings-spt
++    pkg_exists solo5-bindings-muen && PKG_CONFIG_DEPS=solo5-bindings-muen
++    pkg_exists solo5-bindings-virtio && PKG_CONFIG_DEPS=solo5-bindings-virtio
++    pkg_exists solo5-bindings-genode && PKG_CONFIG_DEPS=solo5-bindings-genode
++    pkg_exists solo5-bindings-xen && PKG_CONFIG_DEPS=solo5-bindings-xen
++else
++    pkg_exists "${PKG_CONFIG_DEPS}" \
++        || (echo "ERROR: ${PKG_CONFIG_DEPS} is not installed" 1>&2; exit 1) \
++        || exit 1
++fi
+ if [ -z "${PKG_CONFIG_DEPS}" ]; then
+     echo "ERROR: No supported Solo5 bindings package found." 1>&2
+     echo "ERROR: solo5-bindings-hvt, solo5-bindings-spt, solo5-bindings-virtio, solo5-bindings-muen, solo5-bindings-genode or solo5-bindings-xen must be installed." 1>&2
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/default.nix
new file mode 100644
index 000000000000..cf72397057db
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/default.nix
@@ -0,0 +1,87 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, ocaml
+, pkg-config
+, solo5
+, target ? "xen"
+}:
+
+# note: this is not technically an ocaml-module,
+# but can be built with different compilers, so
+# the ocamlPackages set is very useful.
+
+let
+  pname = "ocaml-freestanding";
+in
+
+if lib.versionOlder ocaml.version "4.08"
+then builtins.throw "${pname} is not available for OCaml ${ocaml.version}"
+else
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-${pname}-${version}";
+  inherit pname;
+  version = "0.6.4";
+
+  src = fetchFromGitHub {
+    owner = "mirage";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0w3x2wfd04qr6mci4cp1gfqw33yysp8gamgkpgbgwslr0skryiq5";
+  };
+
+  postUnpack = ''
+    # get ocaml-src from the ocaml drv instead of via ocamlfind
+    mkdir -p "${src.name}/ocaml"
+    tar --strip-components=1 -xf ${ocaml.src} -C "${src.name}/ocaml"
+  '';
+
+  patches = [
+    ./no-opam.patch
+    ./configurable-binding.patch
+  ];
+
+  nativeBuildInputs = [
+    ocaml
+    pkg-config
+  ];
+
+  propagatedBuildInputs = [ solo5 ];
+
+  configurePhase = ''
+    runHook preConfigure
+    env PKG_CONFIG_DEPS=solo5-bindings-${target} sh configure.sh
+    runHook postConfigure
+  '';
+
+  preBuild = ''
+    # perform substitutions, so opam isn't needed
+    for flags in flags/cflags.tmp flags/libs.tmp; do
+      substitute "$flags.in" "$flags" \
+        --replace "%{prefix}%" "$out" \
+        --replace "%{ocaml-freestanding:lib}%" "$out/lib"
+    done
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    ./install.sh "$out"
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Freestanding OCaml runtime";
+    license = licenses.mit;
+    maintainers = [ maintainers.sternenseemann ];
+    homepage = "https://github.com/mirage/ocaml-freestanding";
+    platforms = builtins.map ({ arch, os }: "${arch}-${os}")
+      (cartesianProductOfSets {
+          arch = [ "aarch64" "x86_64" ];
+          os = [ "linux" ];
+      } ++ [
+        { arch = "x86_64"; os = "freebsd"; }
+        { arch = "x86_64"; os = "openbsd"; }
+      ]);
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/no-opam.patch b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/no-opam.patch
new file mode 100644
index 000000000000..43141b1472a9
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-freestanding/no-opam.patch
@@ -0,0 +1,84 @@
+commit 637b7ce639d54e617170433aa9596176b167d085
+Author: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>
+Date:   Thu Mar 18 01:07:49 2021 +0100
+
+    Allow building without ocamlfind and opam
+    
+    This change is the result of my first go at packaging ocaml-freestanding
+    for NixOS. Our build infrastructure for ocaml there is completely
+    independent of opam at the moment, so depending on opam for the build
+    time is not an option, especially in this case where the information it
+    would give us would be garbage.
+    
+    Fortunately the build environment plays nicely with pkg-config which is
+    already heavily used by ocaml-freestanding. This patch leaves pkg-config
+    to its own devices if opam is not present (it can be assisted by a
+    manually set PKG_CONFIG_PATH environment variable).
+    
+    Additionally, in configure.sh we check if the target ocaml source
+    directory already exists. This allows for building ocaml-freestanding
+    without the ocaml-src package (which would be unnecessarily cumbersome
+    to package for NixOS) and ocamlfind (one less dependency is always a
+    nice bonus). The Makefile needs no fix since the target ocaml/Makefile
+    won't be built if it's already present.
+
+diff --git a/Makefile b/Makefile
+index b07b8c6..a68b31d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,6 +2,12 @@
+ 
+ include Makeconf
+ 
++ifneq ($(shell command -v opam),)
++	# only set if opam is available and PKG_CONFIG_PATH isn't
++	# already set in the environment or on the command line
++	PKG_CONFIG_PATH ?= $(shell opam config var prefix)/lib/pkgconfig
++endif
++
+ FREESTANDING_LIBS=openlibm/libopenlibm.a \
+ 		  ocaml/runtime/libasmrun.a \
+ 		  nolibc/libnolibc.a
+@@ -73,8 +79,7 @@ flags/libs.tmp: flags/libs.tmp.in
+ 	opam config subst $@
+ 
+ flags/libs: flags/libs.tmp Makeconf
+-	env PKG_CONFIG_PATH="$(shell opam config var prefix)/lib/pkgconfig" \
+-	    pkg-config $(PKG_CONFIG_DEPS) --libs >> $<
++	pkg-config $(PKG_CONFIG_DEPS) --libs >> $<
+ 	awk -v RS= -- '{ \
+ 	    sub("@@PKG_CONFIG_EXTRA_LIBS@@", "$(PKG_CONFIG_EXTRA_LIBS)", $$0); \
+ 	    print "(", $$0, ")" \
+@@ -84,8 +89,7 @@ flags/cflags.tmp: flags/cflags.tmp.in
+ 	opam config subst $@
+ 
+ flags/cflags: flags/cflags.tmp Makeconf
+-	env PKG_CONFIG_PATH="$(shell opam config var prefix)/lib/pkgconfig" \
+-	    pkg-config $(PKG_CONFIG_DEPS) --cflags >> $<
++	pkg-config $(PKG_CONFIG_DEPS) --cflags >> $<
+ 	awk -v RS= -- '{ \
+ 	    print "(", $$0, ")" \
+ 	    }' $< >$@
+diff --git a/configure.sh b/configure.sh
+index 4d154ed..c254f7b 100755
+--- a/configure.sh
++++ b/configure.sh
+@@ -1,6 +1,8 @@
+ #!/bin/sh
+ 
+-export PKG_CONFIG_PATH=$(opam config var prefix)/lib/pkgconfig
++if command -v opam &> /dev/null; then
++    export PKG_CONFIG_PATH=$(opam config var prefix)/lib/pkgconfig
++fi
+ pkg_exists() {
+     pkg-config --exists "$@"
+ }
+@@ -21,7 +23,7 @@ if [ -z "${PKG_CONFIG_DEPS}" ]; then
+     echo "ERROR: solo5-bindings-hvt, solo5-bindings-spt, solo5-bindings-virtio, solo5-bindings-muen, solo5-bindings-genode or solo5-bindings-xen must be installed." 1>&2
+     exit 1
+ fi
+-ocamlfind query ocaml-src >/dev/null || exit 1
++[ -e "$(dirname "$0")/ocaml" ] || ocamlfind query ocaml-src >/dev/null || exit 1
+ 
+ FREESTANDING_CFLAGS="$(pkg-config --cflags ${PKG_CONFIG_DEPS})"
+ BUILD_ARCH="$(uname -m)"
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/camomile.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/camomile.nix
new file mode 100644
index 000000000000..012f3b61ff32
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/camomile.nix
@@ -0,0 +1,16 @@
+{ buildDunePackage, ocaml_gettext, camomile, ounit, fileutils }:
+
+buildDunePackage {
+  pname = "gettext-camomile";
+  inherit (ocaml_gettext) src version useDune2;
+
+  propagatedBuildInputs = [ camomile ocaml_gettext ];
+
+  doCheck = true;
+  checkInputs = [ ounit fileutils ];
+
+  meta = ocaml_gettext.meta // {
+    description = "Internationalization library using camomile (i18n)";
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
index ba571b32084e..7525a10030eb 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
@@ -6,6 +6,8 @@ buildDunePackage rec {
 
   minimumOCamlVersion = "4.03";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/gildor478/ocaml-gettext/releases/download/v${version}/gettext-v${version}.tbz";
     sha256 = "19ynsldb21r539fiwz1f43apsdnx7hj2a2d9qr9wg2hva9y2qrwb";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/stub.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/stub.nix
index b18c0abc530b..51e902b91408 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/stub.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-gettext/stub.nix
@@ -1,14 +1,16 @@
-{ lib, buildDunePackage, ocaml_gettext, ounit }:
+{ buildDunePackage, ocaml_gettext, dune-configurator, ounit }:
 
 buildDunePackage rec {
 
   pname = "gettext-stub";
 
-  inherit (ocaml_gettext) src version meta;
+  inherit (ocaml_gettext) src version useDune2 meta;
+
+  buildInputs = [ dune-configurator ];
 
   propagatedBuildInputs = [ ocaml_gettext ];
 
   doCheck = true;
 
-  checkInputs = lib.optional doCheck ounit;
+  checkInputs = [ ounit ];
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
index 0391498c37ae..a56621465f34 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
@@ -1,78 +1,21 @@
-{ buildDunePackage
-, stdlib-shims
-, ppx_yojson_conv_lib
-, ocaml-syntax-shims
-, yojson
-, result
-, omd
-, octavius
-, dune-build-info
-, uutf
-, csexp
-, cmdliner
-, fetchzip
-, lib
-}:
-let
-  version = "1.4.0";
-  src = fetchzip {
-    url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz";
-    sha256 = "16vvwq3d9xmr91r6yv5i2gyqcdliji7asyq4g6iygi617233fa33";
-  };
-
-  # unvendor some (not all) dependencies.
-  # They are vendored by upstream only because it is then easier to install
-  # ocaml-lsp without messing with your opam switch, but nix should prevent
-  # this type of problems without resorting to vendoring.
-  preBuild = ''
-    rm -r ocaml-lsp-server/vendor/{octavius,uutf,ocaml-syntax-shims,omd,cmdliner}
-  '';
-
-  buildInputs = [
-    stdlib-shims
-    ppx_yojson_conv_lib
-    ocaml-syntax-shims
-    octavius
-    uutf
-    csexp
-    dune-build-info
-    omd
-    cmdliner
-    jsonrpc
-  ];
-
-  lsp = buildDunePackage {
-    pname = "lsp";
-    inherit version src;
-    useDune2 = true;
-    minimumOCamlVersion = "4.06";
-
-    inherit buildInputs preBuild;
-  };
+{ buildDunePackage, jsonrpc, lsp, makeWrapper, dot-merlin-reader }:
 
-  jsonrpc = buildDunePackage {
-    pname = "jsonrpc";
-    inherit version src;
-    useDune2 = true;
-    minimumOCamlVersion = "4.06";
-
-    buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ];
-  };
-
-in
 buildDunePackage {
   pname = "ocaml-lsp-server";
-  inherit version src;
+  inherit (jsonrpc) version src;
   useDune2 = true;
 
-  inherit preBuild;
+  inherit (lsp) preBuild;
 
-  buildInputs = buildInputs ++ [ lsp ];
+  buildInputs = lsp.buildInputs ++ [ lsp ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  postInstall = ''
+    wrapProgram $out/bin/ocamllsp --prefix PATH : ${dot-merlin-reader}/bin
+  '';
 
-  meta = with lib; {
+  meta = jsonrpc.meta // {
     description = "OCaml Language Server Protocol implementation";
-    license = lib.licenses.isc;
-    platforms = platforms.unix;
-    maintainers = [ maintainers.symphorien ];
   };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix
new file mode 100644
index 000000000000..701604c8710a
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix
@@ -0,0 +1,31 @@
+{ buildDunePackage
+, stdlib-shims
+, ppx_yojson_conv_lib
+, ocaml-syntax-shims
+, yojson
+, result
+, fetchzip
+, lib
+}:
+
+
+buildDunePackage rec {
+  pname = "jsonrpc";
+  version = "1.4.1";
+  src = fetchzip {
+    url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz";
+    sha256 = "0hzpw17qfhb0cxgwah1fv4k300r363dy1kv0977anl44dlanx1v5";
+  };
+
+  useDune2 = true;
+  minimumOCamlVersion = "4.06";
+
+  buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ];
+
+  meta = with lib; {
+    description = "Jsonrpc protocol implementation in OCaml";
+    license = licenses.isc;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ symphorien marsam ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix
new file mode 100644
index 000000000000..b501282c1558
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix
@@ -0,0 +1,44 @@
+{ buildDunePackage
+, stdlib-shims
+, ppx_yojson_conv_lib
+, ocaml-syntax-shims
+, jsonrpc
+, omd
+, octavius
+, dune-build-info
+, uutf
+, csexp
+, cmdliner
+}:
+
+buildDunePackage {
+  pname = "lsp";
+  inherit (jsonrpc) version src;
+  useDune2 = true;
+  minimumOCamlVersion = "4.06";
+
+  # unvendor some (not all) dependencies.
+  # They are vendored by upstream only because it is then easier to install
+  # ocaml-lsp without messing with your opam switch, but nix should prevent
+  # this type of problems without resorting to vendoring.
+  preBuild = ''
+    rm -r ocaml-lsp-server/vendor/{octavius,uutf,ocaml-syntax-shims,omd,cmdliner}
+  '';
+
+  buildInputs = [
+    stdlib-shims
+    ppx_yojson_conv_lib
+    ocaml-syntax-shims
+    octavius
+    uutf
+    csexp
+    dune-build-info
+    omd
+    cmdliner
+    jsonrpc
+  ];
+
+  meta = jsonrpc.meta // {
+    description = "LSP protocol implementation in OCaml";
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/2.1.x.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/2.1.x.nix
index afe3d34963ae..ca88fe32416a 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/2.1.x.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/2.1.x.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
    pname = "ocaml-migrate-parsetree";
    version = "2.1.0";
 
+   useDune2 = true;
+
    minimumOCamlVersion = "4.02";
 
    src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-result/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-result/default.nix
index 2814c6c52806..2fda6f1440be 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-result/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-result/default.nix
@@ -1,9 +1,11 @@
-{ lib, buildDunePackage, fetchurl }:
+{ lib, buildDunePackage, fetchurl, ocaml }:
 
 buildDunePackage rec {
   pname = "result";
   version = "1.5";
 
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
+
   src = fetchurl {
     url = "https://github.com/janestreet/result/releases/download/${version}/result-${version}.tbz";
     sha256 = "0cpfp35fdwnv3p30a06wd0py3805qxmq3jmcynjc3x2qhlimwfkw";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-version/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-version/default.nix
index 54133850e077..4fde475cf936 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-version/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-version/default.nix
@@ -7,6 +7,8 @@ buildDunePackage rec {
 
   minimumOCamlVersion = "4.07";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/ocurrent/ocaml-version/releases/download/v${version}/ocaml-version-v${version}.tbz";
     sha256 = "15vk8sh50p3f2mbv8z7mqnx76cffri36f2krp25zkkwix8jg7ci4";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocamlnet/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocamlnet/default.nix
index 1da80a2202d7..bdbbf1d8c67f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocamlnet/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocamlnet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, pkg-config, ncurses, ocaml, findlib, ocaml_pcre, camlzip
+{ stdenv, lib, fetchurl, pkg-config, which, ncurses, ocaml, findlib, ocaml_pcre, camlzip
 , gnutls, nettle
 }:
 
@@ -8,14 +8,14 @@ else
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-ocamlnet-${version}";
-  version = "4.1.8";
+  version = "4.1.9";
 
   src = fetchurl {
     url = "http://download.camlcity.org/download/ocamlnet-${version}.tar.gz";
-    sha256 = "1x703mjqsv9nvffnkj5i36ij2s5zfvxxll2z1qj6a7p428b2yfnm";
+    sha256 = "1vlwxjxr946gdl61a1d7yk859cijq45f60dhn54ik3w4g6cx33pr";
   };
 
-  nativeBuildInputs = [ pkg-config ];
+  nativeBuildInputs = [ pkg-config which ];
   buildInputs = [ ncurses ocaml findlib ocaml_pcre camlzip gnutls nettle ];
 
   createFindlibDestdir = true;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocsigen-server/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocsigen-server/default.nix
index b4842da12dd7..cf869b6e5ef9 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocsigen-server/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocsigen-server/default.nix
@@ -29,9 +29,8 @@ stdenv.mkDerivation rec {
     sha256 = "0xda4fj8p5102lh9xmrn5mv3s0ps6yykqj3mpjf72gf4zd6fzcn7";
   }) ];
 
-  buildInputs = [ which makeWrapper ocaml findlib
-    lwt_react pgocaml camlzip ocaml_sqlite3
-  ];
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ which ocaml findlib lwt_react pgocaml camlzip ocaml_sqlite3 ];
 
   propagatedBuildInputs = [ cryptokit ipaddr lwt_log lwt_ssl ocamlnet
     ocaml_pcre tyxml xml-light
diff --git a/nixpkgs/pkgs/development/ocaml-modules/opti/default.nix b/nixpkgs/pkgs/development/ocaml-modules/opti/default.nix
index 9638e8e0d4ef..4ce5087912d2 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/opti/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/opti/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "opti";
   version = "1.0.3";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.02";
 
   src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/optint/default.nix b/nixpkgs/pkgs/development/ocaml-modules/optint/default.nix
index 18e4bd1ae864..7f8ded5feb6c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/optint/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/optint/default.nix
@@ -9,6 +9,8 @@ buildDunePackage rec {
     sha256 = "1a7gabxqmfvii8qnxq1clx43md2h9glskxhac8y8r0rhzblx3s1a";
   };
 
+  useDune2 = true;
+
   meta = {
     homepage = "https://github.com/mirage/optint";
     description = "Abstract type of integer between x64 and x86 architecture";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ounit2/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ounit2/default.nix
index 52676a1c88d9..0b68609584d4 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ounit2/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ounit2/default.nix
@@ -6,6 +6,8 @@ buildDunePackage rec {
   pname = "ounit2";
   version = "2.2.4";
 
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
+
   src = fetchurl {
     url = "https://github.com/gildor478/ounit/releases/download/v${version}/ounit-v${version}.tbz";
     sha256 = "0i9kiqbf2dp12c4qcvbn4abdpdp6h4g5z54ycsh0q8jpv6jnkh5m";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/owl-base/default.nix b/nixpkgs/pkgs/development/ocaml-modules/owl-base/default.nix
index b930ea88654b..b767b1db24c8 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/owl-base/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/owl-base/default.nix
@@ -2,13 +2,13 @@
 
 buildDunePackage rec {
   pname = "owl-base";
-  version = "1.0.0";
+  version = "1.0.1";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/owlbarn/owl/releases/download/${version}/owl-${version}.tbz";
-    sha256 = "1gny4351ws2r7dp53nampfyh39l0z6qqvxj5v3d05mpdi2aa06yr";
+    sha256 = "72ca9f6edd302fdfa16c7559cedac7ac2c885466a367e17ea1ea8807b2dd13ef";
   };
 
   minimumOCamlVersion = "4.10";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/parany/default.nix b/nixpkgs/pkgs/development/ocaml-modules/parany/default.nix
index afe9e7d39b57..a4378016b47c 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/parany/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/parany/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "parany";
   version = "8.0.0";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "UnixJunkie";
     repo   = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/parmap/default.nix b/nixpkgs/pkgs/development/ocaml-modules/parmap/default.nix
index 5127dc3b1e6d..7adc8482b232 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/parmap/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/parmap/default.nix
@@ -1,14 +1,18 @@
-{ lib, buildDunePackage, fetchurl }:
+{ lib, buildDunePackage, fetchurl, dune-configurator }:
 
 buildDunePackage rec {
   pname = "parmap";
-  version = "1.1.1";
+  version = "1.2";
+
+  useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/rdicosmo/${pname}/releases/download/${version}/${pname}-${version}.tbz";
-    sha256 = "1pci7b1jqxkgmrbhr0p5j98i4van5nfmmb3sak8cyvxhwgna93j4";
+    sha256 = "sha256-XUXptzD0eytaypaBQ+EBp4iVFRE6/Y0inS93t/YZrM8=";
   };
 
+  buildInputs = [ dune-configurator ];
+
   doCheck = true;
 
   meta = with lib; {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/pbkdf/default.nix b/nixpkgs/pkgs/development/ocaml-modules/pbkdf/default.nix
new file mode 100644
index 000000000000..1ecf213f6d36
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/pbkdf/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildDunePackage
+, fetchurl
+, mirage-crypto
+, alcotest
+}:
+
+buildDunePackage rec {
+  pname = "pbkdf";
+  version = "1.1.0";
+
+  useDune2 = true;
+
+  src = fetchurl {
+    url = "https://github.com/abeaumont/ocaml-pbkdf/releases/download/${version}/pbkdf-${version}.tbz";
+    sha256 = "e53ed1bd9abf490c858a341c10fb548bc9ad50d4479acdf95a9358a73d042264";
+  };
+
+  propagatedBuildInputs = [ mirage-crypto ];
+  checkInputs = [ alcotest ];
+  doCheck = true;
+
+  meta = {
+    description = "Password based key derivation functions (PBKDF) from PKCS#5";
+    maintainers = [ lib.maintainers.sternenseemann ];
+    license = lib.licenses.bsd2;
+    homepage = "https://github.com/abeaumont/ocaml-pbkdf";
+  };
+}
+
diff --git a/nixpkgs/pkgs/development/ocaml-modules/pgocaml/default.nix b/nixpkgs/pkgs/development/ocaml-modules/pgocaml/default.nix
index f67d614af3ae..5c00f2c8991f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/pgocaml/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/pgocaml/default.nix
@@ -4,12 +4,12 @@
 
 buildDunePackage rec {
   pname = "pgocaml";
-  version = "4.2.2";
+  version = "4.2.2-dev-20210111";
   src = fetchFromGitHub {
     owner = "darioteixeira";
     repo = "pgocaml";
-    rev = version;
-    sha256 = "1rdypc83nap9j2ml9r6n1pzgf79gk1yffwyi6fmcrl7zmy01cg0n";
+    rev = "1bb0025deeb3d14029afdcc69aaa7847026e243e";
+    sha256 = "11inbjf87gclc2xmpq56ag4cm4467y9q9hjgbdn69fa1bman2zn2";
   };
 
   minimumOCamlVersion = "4.08";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/pgocaml/ppx.nix b/nixpkgs/pkgs/development/ocaml-modules/pgocaml/ppx.nix
index 35c19622f88d..dce2e2b0c99d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/pgocaml/ppx.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/pgocaml/ppx.nix
@@ -1,8 +1,8 @@
-{ buildDunePackage, pgocaml, ppx_optcomp, ppx_tools, ppx_tools_versioned, rresult }:
+{ buildDunePackage, pgocaml, ppx_optcomp }:
 
 buildDunePackage {
   pname = "pgocaml_ppx";
   inherit (pgocaml) src version useDune2 meta;
 
-  propagatedBuildInputs = [ pgocaml ppx_optcomp ppx_tools ppx_tools_versioned rresult ];
+  propagatedBuildInputs = [ pgocaml ppx_optcomp ];
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_bap/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_bap/default.nix
new file mode 100644
index 000000000000..f0a223c3db75
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_bap/default.nix
@@ -0,0 +1,51 @@
+{ lib, buildDunePackage
+, fetchFromGitHub
+, ppx_assert
+, ppx_bench
+, ppx_bin_prot
+, ppx_compare
+, ppx_enumerate
+, ppx_hash
+, ppx_here
+, ppx_optcomp
+, ppx_sexp_conv
+, ppx_sexp_value
+}:
+
+buildDunePackage rec {
+  pname = "ppx_bap";
+  version = "0.14";
+  useDune2 = true;
+
+  minimumOCamlVersion = "4.07";
+
+  src = fetchFromGitHub {
+    owner = "BinaryAnalysisPlatform";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1c6rcdp8bicdiwqc2mb59cl9l2vxlp3y8hmnr9x924fq7acly248";
+  };
+
+  buildInputs = [
+    ppx_optcomp
+    ppx_sexp_value
+  ];
+
+  propagatedBuildInputs = [
+    ppx_assert
+    ppx_bench
+    ppx_bin_prot
+    ppx_compare
+    ppx_enumerate
+    ppx_hash
+    ppx_here
+    ppx_sexp_conv
+  ];
+
+  meta = {
+    description = "The set of ppx rewriters for BAP";
+    license = lib.licenses.mit;
+    inherit (src.meta) homepage;
+    maintainers = [ lib.maintainers.vbgl ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_cstubs/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_cstubs/default.nix
new file mode 100644
index 000000000000..b4ddb4dd5e45
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_cstubs/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, fetchFromGitHub
+, buildDunePackage
+, bigarray-compat
+, containers
+, cppo
+, ctypes
+, integers
+, num
+, ppxlib
+, re
+}:
+
+buildDunePackage rec {
+  pname = "ppx_cstubs";
+  version = "0.6.1.1";
+
+  useDune2 = true;
+
+  src = fetchFromGitHub {
+    owner = "fdopen";
+    repo = "ppx_cstubs";
+    rev = version;
+    sha256 = "0rgg78435ypi6ryhcq5ljkch4qjvra2jqjd47c2hhhcbwvi2ssxh";
+  };
+
+  buildInputs = [
+    bigarray-compat
+    containers
+    cppo
+    ctypes
+    integers
+    num
+    ppxlib
+    re
+  ];
+
+  meta = with lib; {
+    homepage = "https://github.com/fdopen/ppx_cstubs";
+    description = "Preprocessor for easier stub generation with ocaml-ctypes";
+    license = licenses.mit;
+    maintainers = [ maintainers.osener ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_derivers/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_derivers/default.nix
index 3d4675ed90b9..84dda38846fe 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ppx_derivers/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_derivers/default.nix
@@ -1,9 +1,11 @@
-{ lib, fetchFromGitHub, buildDunePackage }:
+{ lib, fetchFromGitHub, buildDunePackage, ocaml }:
 
 buildDunePackage rec {
   pname = "ppx_derivers";
   version = "1.2.1";
 
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
+
   minimumOCamlVersion = "4.02";
 
   src = fetchFromGitHub {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_deriving/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_deriving/default.nix
index 910e53900966..7d415bd894e0 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ppx_deriving/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_deriving/default.nix
@@ -1,15 +1,28 @@
-{ lib, fetchurl, buildDunePackage
-, cppo, ppxlib, ppx_derivers, result, ounit, ocaml-migrate-parsetree
+{ lib
+, fetchurl
+, buildDunePackage
+, cppo
+, ppxlib
+, ppx_derivers
+, result
+, ounit
+, ocaml-migrate-parsetree
+, ocaml-migrate-parsetree-2-1
 }:
 
 let params =
-  if lib.versionAtLeast ppxlib.version "0.15"
-  then {
+  if lib.versionAtLeast ppxlib.version "0.20" then {
+    version = "5.2.1";
+    sha256 = "11h75dsbv3rs03pl67hdd3lbim7wjzh257ij9c75fcknbfr5ysz9";
+    useOMP2 = true;
+  } else if lib.versionAtLeast ppxlib.version "0.15" then {
     version = "5.1";
     sha256 = "1i64fd7qrfzbam5hfbl01r0sx4iihsahcwqj13smmrjlnwi3nkxh";
+    useOMP2 = false;
   } else {
     version = "5.0";
     sha256 = "0fkzrn4pdyvf1kl0nwvhqidq01pnq3ql8zk1jd56hb0cxaw851w3";
+    useOMP2 = false;
   }
 ; in
 
@@ -25,7 +38,13 @@ buildDunePackage rec {
   };
 
   buildInputs = [ ppxlib cppo ];
-  propagatedBuildInputs = [ ocaml-migrate-parsetree ppx_derivers result ];
+  propagatedBuildInputs = [
+    (if params.useOMP2
+    then ocaml-migrate-parsetree-2-1
+    else ocaml-migrate-parsetree)
+    ppx_derivers
+    result
+  ];
 
   doCheck = true;
   checkInputs = [ ounit ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_import/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_import/default.nix
index b5651a8cec2a..4ad26ff0862b 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ppx_import/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_import/default.nix
@@ -1,27 +1,28 @@
-{ lib, fetchurl, buildDunePackage, ocaml
-, ounit, ppx_deriving, ppx_tools_versioned
-, ppxlib, ocaml-migrate-parsetree
+{ lib, fetchurl, buildDunePackage
+, ppx_tools_versioned
+, ocaml-migrate-parsetree
+, ounit, ppx_deriving, ppxlib
 }:
 
 buildDunePackage rec {
   pname = "ppx_import";
-  version = "1.7.1";
+  version = "1.8.0";
 
   useDune2 = true;
 
   minimumOCamlVersion = "4.04";
 
   src = fetchurl {
-    url = "https://github.com/ocaml-ppx/ppx_import/releases/download/v${version}/ppx_import-v${version}.tbz";
-    sha256 = "16dyxfb7syz659rqa7yq36ny5vzl7gkqd7f4m6qm2zkjc1gc8j4v";
+    url = "https://github.com/ocaml-ppx/ppx_import/releases/download/v${version}/ppx_import-${version}.tbz";
+    sha256 = "0zqcj70yyp4ik4jc6jz3qs2xhb94vxc6yq9ij0d5cyak28klc3gv";
   };
 
   propagatedBuildInputs = [
-    ppxlib ppx_tools_versioned ocaml-migrate-parsetree
+    ppx_tools_versioned ocaml-migrate-parsetree
   ];
 
   doCheck = true;
-  checkInputs = [ ounit ppx_deriving ];
+  checkInputs = [ ounit ppx_deriving ppxlib ];
 
   meta = {
     description = "A syntax extension that allows to pull in types or signatures from other compiled interface files";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppx_yojson_conv_lib/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppx_yojson_conv_lib/default.nix
index 442a4126a897..07d817d22938 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ppx_yojson_conv_lib/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppx_yojson_conv_lib/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "ppx_yojson_conv_lib";
   version = "0.14.0";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.02.3";
 
   src = fetchFromGitHub {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ppxlib/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ppxlib/default.nix
index 03085a13cdf0..c92992197d22 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ppxlib/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ppxlib/default.nix
@@ -1,5 +1,8 @@
 { lib, fetchFromGitHub, buildDunePackage, ocaml
-, version ? if lib.versionAtLeast ocaml.version "4.07" then "0.15.0" else "0.13.0"
+, version ?
+  if lib.versionAtLeast ocaml.version "4.07"
+  then if lib.versionAtLeast ocaml.version "4.08"
+  then "0.22.0" else "0.15.0" else "0.13.0"
 , ocaml-compiler-libs, ocaml-migrate-parsetree, ppx_derivers, stdio
 , stdlib-shims, ocaml-migrate-parsetree-2-1
 }:
@@ -19,11 +22,17 @@ let param = {
   "0.15.0" = {
     sha256 = "1p037kqj5858xrhh0dps6vbf4fnijla6z9fjz5zigvnqp4i2xkrn";
     min_version = "4.07";
+    max_version = "4.12";
     useOMP2 = false;
   };
   "0.18.0" = {
     sha256 = "1ciy6va2gjrpjs02kha83pzh0x1gkmfsfsdgabbs1v14a8qgfibm";
     min_version = "4.07";
+    max_version = "4.12";
+  };
+  "0.22.0" = {
+    sha256 = "0kf7lgcwygf6zlx7rwddqpqvasa6v7xiq0bqal8vxlib6lpg074q";
+    min_version = "4.07";
   };
 }."${version}"; in
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/psmt2-frontend/default.nix b/nixpkgs/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
index 30fb5de7cb8e..dbdf3970f636 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
@@ -1,35 +1,27 @@
-{ stdenv, lib, fetchFromGitHub, autoreconfHook, ocaml, findlib, menhir }:
+{ lib, fetchFromGitHub, buildDunePackage, menhir }:
 
-if !lib.versionAtLeast ocaml.version "4.03"
-then throw "psmt2-frontend is not available for OCaml ${ocaml.version}"
-else
-
-stdenv.mkDerivation rec {
-  version = "0.2";
-  name = "ocaml${ocaml.version}-psmt2-frontend-${version}";
+buildDunePackage rec {
+  version = "0.3.1";
+  pname = "psmt2-frontend";
 
   src = fetchFromGitHub {
-    owner = "Coquera";
-    repo = "psmt2-frontend";
+    owner = "ACoquereau";
+    repo = pname;
     rev = version;
-    sha256 = "097zmbrx4gp2gnrxdmsm9lkkp5450gwi0blpxqy3833m6k5brx3n";
+    sha256 = "038jrfsq09nhnzpjiishg4adk09w3aw1bpczgbj66lqqilkd6gci";
   };
 
-  prefixKey = "-prefix ";
-
-  nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [ ocaml findlib menhir ];
+  useDune2 = true;
 
-  createFindlibDestdir = true;
+  minimumOCamlVersion = "4.03";
 
-  installFlags = [ "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
+  buildInputs = [ menhir ];
 
   meta = {
     description = "A simple parser and type-checker for polomorphic extension of the SMT-LIB 2 language";
     license = lib.licenses.asl20;
     maintainers = [ lib.maintainers.vbgl ];
     inherit (src.meta) homepage;
-    inherit (ocaml.meta) platforms;
   };
 
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/psq/default.nix b/nixpkgs/pkgs/development/ocaml-modules/psq/default.nix
index ff9c52c50a76..f7c2f3497a11 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/psq/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/psq/default.nix
@@ -1,10 +1,12 @@
-{ lib, buildDunePackage, fetchurl, seq }:
+{ lib, buildDunePackage, ocaml, fetchurl, seq, qcheck-alcotest }:
 
 buildDunePackage rec {
   minimumOCamlVersion = "4.03";
   pname = "psq";
   version = "0.2.0";
 
+  useDune2 = true;
+
   src = fetchurl {
     url = "https://github.com/pqwy/psq/releases/download/v${version}/psq-v${version}.tbz";
     sha256 = "1j4lqkq17rskhgcrpgr4n1m1a2b1x35mlxj6f9g05rhpmgvgvknk";
@@ -12,6 +14,9 @@ buildDunePackage rec {
 
   propagatedBuildInputs = [ seq ];
 
+  doCheck = lib.versionAtLeast ocaml.version "4.07";
+  checkInputs = [ qcheck-alcotest ];
+
   meta = {
     description = "Functional Priority Search Queues for OCaml";
     homepage = "https://github.com/pqwy/psq";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/qcheck/core.nix b/nixpkgs/pkgs/development/ocaml-modules/qcheck/core.nix
index 03de70237a46..e1b3503b5418 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/qcheck/core.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/qcheck/core.nix
@@ -2,7 +2,7 @@
 
 buildDunePackage rec {
   pname = "qcheck-core";
-  version = "0.16";
+  version = "0.17";
 
   useDune2 = true;
 
@@ -12,7 +12,7 @@ buildDunePackage rec {
     owner = "c-cube";
     repo = "qcheck";
     rev = version;
-    sha256 = "1s5dpqj8zvd3wr2w3fp4wb6yc57snjpxzzfv9fb6l9qgigswwjdr";
+    sha256 = "0qfyqhfg98spmfci9z6f527a16gwjnx2lrbbgw67p37ys5acrfar";
   };
 
   meta = {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/qtest/default.nix b/nixpkgs/pkgs/development/ocaml-modules/qtest/default.nix
index d5829127a8bc..5e9a89a83769 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/qtest/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/qtest/default.nix
@@ -2,7 +2,7 @@
 
 buildDunePackage rec {
   pname = "qtest";
-  version = "2.11.1";
+  version = "2.11.2";
 
   useDune2 = true;
 
@@ -10,7 +10,7 @@ buildDunePackage rec {
     owner = "vincent-hugot";
     repo = pname;
     rev = "v${version}";
-    sha256 = "01aaqnblpkrkv1b2iy5cwn92vxdj4yjiav9s2nvvrqz5m8b9hi1f";
+    sha256 = "sha256-VLY8+Nu6md0szW4RVxTFwlSQ9kyrgUqf7wQEA6GW8BE=";
   };
 
   propagatedBuildInputs = [ qcheck ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/re/default.nix b/nixpkgs/pkgs/development/ocaml-modules/re/default.nix
index ca3cf1e82675..4734d4a9bf52 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/re/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/re/default.nix
@@ -6,6 +6,8 @@ buildDunePackage rec {
 
   minimumOCamlVersion = "4.02";
 
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
+
   src = fetchurl {
     url = "https://github.com/ocaml/ocaml-re/releases/download/${version}/re-${version}.tbz";
     sha256 = "1gas4ky49zgxph3870nffzkr6y41kkpqp4nj38pz1gh49zcf12aj";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/rope/default.nix b/nixpkgs/pkgs/development/ocaml-modules/rope/default.nix
index 481342e98c7a..f29219e30c24 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/rope/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/rope/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, dune, benchmark }:
+{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, dune_2, benchmark }:
 
 let param =
   if lib.versionAtLeast ocaml.version "4.03"
@@ -6,7 +6,7 @@ let param =
     version = "0.6.2";
     url = "https://github.com/Chris00/ocaml-rope/releases/download/${version}/rope-${version}.tbz";
     sha256 = "15cvfa0s1vjx7gjd07d3fkznilishqf4z4h2q5f20wm9ysjh2h2i";
-    buildInputs = [ dune ];
+    buildInputs = [ dune_2 ];
     extra = {
       buildPhase = "dune build -p rope";
       installPhase = ''
diff --git a/nixpkgs/pkgs/development/ocaml-modules/sha/default.nix b/nixpkgs/pkgs/development/ocaml-modules/sha/default.nix
new file mode 100644
index 000000000000..a506e6795fd1
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/sha/default.nix
@@ -0,0 +1,28 @@
+{ lib
+, fetchurl
+, buildDunePackage
+, ounit
+}:
+
+buildDunePackage rec {
+  pname = "sha";
+  version = "1.13";
+
+  useDune2 = true;
+
+  src = fetchurl {
+    url = "https://github.com/djs55/ocaml-${pname}/releases/download/v${version}/${pname}-v${version}.tbz";
+    sha256 = "00z2s4fsv9i1h09rj5dy3nd9hhcn79b75sn2ljj5wihlf4y4g304";
+  };
+
+  doCheck = true;
+  checkInputs = [ ounit ];
+
+  meta = with lib; {
+    description = "Binding for SHA interface code in OCaml";
+    maintainers = [ maintainers.arthurteisseire ];
+    homepage = "https://github.com/djs55/ocaml-${pname}";
+    license = licenses.isc;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/sodium/default.nix b/nixpkgs/pkgs/development/ocaml-modules/sodium/default.nix
index d0c203689e32..dc090e91743f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/sodium/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/sodium/default.nix
@@ -15,6 +15,11 @@ stdenv.mkDerivation rec {
     sha256 = "124gpi1jhac46x05gp5viykyrafnlp03v1cmkl13c6pgcs8w04pv";
   };
 
+  patches = [
+    # ctypes.stubs no longer pulls in bigarray automatically
+    ./lib-gen-link-bigarray.patch
+  ];
+
   buildInputs = [ ocaml findlib ocamlbuild ];
   propagatedBuildInputs = [ ctypes libsodium ];
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/sodium/lib-gen-link-bigarray.patch b/nixpkgs/pkgs/development/ocaml-modules/sodium/lib-gen-link-bigarray.patch
new file mode 100644
index 000000000000..f05f53320975
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/sodium/lib-gen-link-bigarray.patch
@@ -0,0 +1,7 @@
+diff --git a/lib_gen/_tags b/lib_gen/_tags
+index 7a7e632..7a4e0b7 100644
+--- a/lib_gen/_tags
++++ b/lib_gen/_tags
+@@ -1 +1 @@
+-<*.{ml,byte,native}>: package(ctypes.stubs)
++<*.{ml,byte,native}>: package(ctypes.stubs), package(bigarray)
diff --git a/nixpkgs/pkgs/development/ocaml-modules/sosa/default.nix b/nixpkgs/pkgs/development/ocaml-modules/sosa/default.nix
index 4278989341f1..3687f2be9974 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/sosa/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/sosa/default.nix
@@ -1,7 +1,11 @@
 { lib, fetchFromGitHub, stdenv
-, findlib, nonstd, ocaml, ocamlbuild
+, findlib, ocaml, ocamlbuild
 }:
 
+if !lib.versionAtLeast ocaml.version "4.02"
+then throw "sosa is not available for OCaml ${ocaml.version}"
+else
+
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-sosa-${version}";
   version = "0.3.0";
@@ -13,7 +17,7 @@ stdenv.mkDerivation rec {
     sha256 = "053hdv6ww0q4mivajj4iyp7krfvgq8zajq9d8x4mia4lid7j0dyk";
   };
 
-  buildInputs = [ nonstd ocaml ocamlbuild findlib ];
+  buildInputs = [ ocaml ocamlbuild findlib ];
 
   buildPhase = "make build";
 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/spacetime_lib/default.nix b/nixpkgs/pkgs/development/ocaml-modules/spacetime_lib/default.nix
index db6d184655cb..009b2ce32619 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/spacetime_lib/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/spacetime_lib/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "spacetime_lib";
   version = "0.3.0";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "lpw25";
     repo = "spacetime_lib";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/spelll/default.nix b/nixpkgs/pkgs/development/ocaml-modules/spelll/default.nix
index 5901dcb896ac..9df0779e53a3 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/spelll/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/spelll/default.nix
@@ -6,6 +6,8 @@ buildDunePackage rec {
   pname = "spelll";
   version = "0.3";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "c-cube";
     repo = pname;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/sqlite3/default.nix b/nixpkgs/pkgs/development/ocaml-modules/sqlite3/default.nix
index 1b8f9d629e39..90b469288c7f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/sqlite3/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/sqlite3/default.nix
@@ -1,8 +1,9 @@
-{ lib, fetchurl, sqlite, pkg-config, buildDunePackage }:
+{ lib, fetchurl, sqlite, pkg-config, buildDunePackage, dune-configurator }:
 
 buildDunePackage rec {
   pname = "sqlite3";
   version = "5.0.2";
+  useDune2 = true;
   minimumOCamlVersion = "4.05";
 
   src = fetchurl {
@@ -11,7 +12,7 @@ buildDunePackage rec {
   };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ sqlite ];
+  buildInputs = [ dune-configurator sqlite ];
 
   meta = with lib; {
     homepage = "http://mmottl.github.io/sqlite3-ocaml/";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/stdint/default.nix b/nixpkgs/pkgs/development/ocaml-modules/stdint/default.nix
index bffef61956e2..52d97e12998f 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/stdint/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/stdint/default.nix
@@ -1,18 +1,43 @@
-{ lib, fetchFromGitHub, buildDunePackage }:
+{ lib, fetchurl, fetchpatch, buildDunePackage, qcheck }:
 
 buildDunePackage rec {
   pname = "stdint";
-  version = "0.6.0";
+  version = "0.7.0";
 
-  minimumOCamlVersion = "4.07";
+  useDune2 = true;
 
-  src = fetchFromGitHub {
-    owner = "andrenth";
-    repo = "ocaml-stdint";
-    rev = version;
-    sha256 = "19ccxs0vij81vyc9nqc9kbr154ralb9dgc2y2nr71a5xkx6xfn0y";
+  minimumOCamlVersion = "4.03";
+
+  src = fetchurl {
+    url = "https://github.com/andrenth/ocaml-stdint/releases/download/${version}/stdint-${version}.tbz";
+    sha256 = "4fcc66aef58e2b96e7af3bbca9d910aa239e045ba5fb2400aaef67d0041252dc";
   };
 
+  patches = [
+    # fix test bug, remove at next release
+    (fetchpatch {
+      url = "https://github.com/andrenth/ocaml-stdint/commit/fc64293f99f597cdfd4470954da6fb323988e2af.patch";
+      sha256 = "0nxck14vfjfzldsf8cdj2jg1cvhnyh37hqnrcxbdkqmpx4rxkbxs";
+    })
+  ];
+
+  # 1. disable remaining broken tests, see
+  #    https://github.com/andrenth/ocaml-stdint/issues/59
+  # 2. fix tests to liberal test range
+  #    https://github.com/andrenth/ocaml-stdint/pull/61
+  postPatch = ''
+    substituteInPlace tests/stdint_test.ml \
+      --replace 'test "An integer should perform left-shifts correctly"' \
+                'skip "An integer should perform left-shifts correctly"' \
+      --replace 'test "Logical shifts must not sign-extend"' \
+                'skip "Logical shifts must not sign-extend"' \
+      --replace 'let pos_int = QCheck.map_same_type abs in_range' \
+                'let pos_int = QCheck.int_range 0 maxi'
+  '';
+
+  doCheck = true;
+  checkInputs = [ qcheck ];
+
   meta = {
     description = "Various signed and unsigned integers for OCaml";
     homepage = "https://github.com/andrenth/ocaml-stdint";
diff --git a/nixpkgs/pkgs/development/ocaml-modules/stdlib-shims/default.nix b/nixpkgs/pkgs/development/ocaml-modules/stdlib-shims/default.nix
index d76ec29e63aa..470a2a5bd030 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/stdlib-shims/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/stdlib-shims/default.nix
@@ -2,11 +2,12 @@
 
 buildDunePackage rec {
   pname = "stdlib-shims";
-  version = "0.1.0";
+  version = "0.3.0";
   src = fetchurl {
     url = "https://github.com/ocaml/${pname}/releases/download/${version}/${pname}-${version}.tbz";
-    sha256 = "1jv6yb47f66239m7hsz7zzw3i48mjpbvfgpszws48apqx63wjwsk";
+    sha256 = "0jnqsv6pqp5b5g7lcjwgd75zqqvcwcl5a32zi03zg1kvj79p5gxs";
   };
+  useDune2 = lib.versionAtLeast ocaml.version "4.08";
   minimumOCamlVersion = "4.02";
   doCheck = true;
   meta = {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/tcpip/default.nix b/nixpkgs/pkgs/development/ocaml-modules/tcpip/default.nix
index 80fa01066f1e..4d9f97480ef2 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/tcpip/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/tcpip/default.nix
@@ -1,5 +1,5 @@
 { lib, buildDunePackage, fetchurl
-, bisect_ppx, ppx_cstruct
+, bisect_ppx, ppx_cstruct, pkg-config
 , rresult, cstruct, cstruct-lwt, mirage-net, mirage-clock
 , mirage-random, mirage-stack, mirage-protocols, mirage-time
 , ipaddr, macaddr, macaddr-cstruct, mirage-profile, fmt
@@ -7,22 +7,29 @@
 , alcotest, mirage-flow, mirage-vnetif, pcap-format
 , mirage-clock-unix, arp, ipaddr-cstruct, mirage-random-test
 , lru
+, withFreestanding ? false
+, ocaml-freestanding
 }:
 
 buildDunePackage rec {
   pname = "tcpip";
-  version = "6.0.0";
+  version = "6.1.0";
 
   useDune2 = true;
 
   src = fetchurl {
     url = "https://github.com/mirage/mirage-${pname}/releases/download/v${version}/${pname}-v${version}.tbz";
-    sha256 = "0wbrs8jz1vw3zdrqmqcwawxh4yhc2gy30rw7gz4w116cblkvnb8s";
+    sha256 = "7b3ed2e1ca835c1cc65ac911bcb0de12ebc2b580dd195006bdea2cb387510474";
   };
 
+  patches = [
+    ./makefile-no-opam.patch
+  ];
+
   nativeBuildInputs = [
     bisect_ppx
     ppx_cstruct
+    pkg-config
   ];
 
   propagatedBuildInputs = [
@@ -48,6 +55,8 @@ buildDunePackage rec {
     randomconv
     ethernet
     lru
+  ] ++ lib.optionals withFreestanding [
+    ocaml-freestanding
   ];
 
   doCheck = true;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/tcpip/makefile-no-opam.patch b/nixpkgs/pkgs/development/ocaml-modules/tcpip/makefile-no-opam.patch
new file mode 100644
index 000000000000..1603a1278b0e
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/tcpip/makefile-no-opam.patch
@@ -0,0 +1,12 @@
+diff --git a/freestanding/Makefile b/freestanding/Makefile
+index f22d220d..3e97b4c5 100644
+--- a/freestanding/Makefile
++++ b/freestanding/Makefile
+@@ -1,4 +1,6 @@
+-PKG_CONFIG_PATH := $(shell opam config var prefix)/lib/pkgconfig
++ifneq (, $(shell command -v opam))
++	PKG_CONFIG_PATH ?= $(shell opam config var prefix)/lib/pkgconfig
++endif
+ 
+ EXISTS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --exists ocaml-freestanding; echo $$?)
+ 
diff --git a/nixpkgs/pkgs/development/ocaml-modules/torch/default.nix b/nixpkgs/pkgs/development/ocaml-modules/torch/default.nix
index d90a80c5648c..5f59b4ae056e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/torch/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/torch/default.nix
@@ -17,7 +17,7 @@
 
 buildDunePackage rec {
   pname = "torch";
-  version = "0.11";
+  version = "0.12";
 
   useDune2 = true;
 
@@ -27,7 +27,7 @@ buildDunePackage rec {
     owner = "LaurentMazare";
     repo   = "ocaml-${pname}";
     rev    = version;
-    sha256 = "19zbl9zn6fslrcm6x9cis6nswhwz8mc57nrhkada658n7rcdmskr";
+    sha256 = "0nl6hd2rivhgkc3sdkdmrk3j0ij3xjx1clhqm8m5iznir4g77g91";
   };
 
   buildInputs = [ dune-configurator ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/uucp/default.nix b/nixpkgs/pkgs/development/ocaml-modules/uucp/default.nix
index 020b256c72f5..bb70ff6a4b7e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/uucp/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/uucp/default.nix
@@ -1,12 +1,16 @@
-{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, uchar, uutf, uunf }:
+{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, uchar, uutf, uunf, uucd }:
 
 let
   pname = "uucp";
-  version = "11.0.0";
+  version = "13.0.0";
   webpage = "https://erratique.ch/software/${pname}";
+  minimumOCamlVersion = "4.03";
+  doCheck = true;
 in
 
-assert lib.versionAtLeast ocaml.version "4.01";
+if !(lib.versionAtLeast ocaml.version minimumOCamlVersion)
+then builtins.throw "${pname} needs at least OCaml ${minimumOCamlVersion}"
+else
 
 stdenv.mkDerivation {
 
@@ -14,17 +18,29 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "0pidg2pmqsifmk4xx9cc5p5jprhg26xb68g1xddjm7sjzbdzhlm4";
+    sha256 = "sha256-OPpHbCOC/vMFdyHwyhCSisUv2PyO8xbeY2oq1a9HbqY=";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild topkg uutf uunf ];
 
   propagatedBuildInputs = [ uchar ];
 
-  buildPhase = "${topkg.buildPhase} --with-cmdliner false";
+  buildPhase = ''
+    runHook preBuild
+    ${topkg.buildPhase} --with-cmdliner false --tests ${lib.boolToString doCheck}
+    runHook postBuild
+  '';
 
   inherit (topkg) installPhase;
 
+  inherit doCheck;
+  checkPhase = ''
+    runHook preCheck
+    ${topkg.run} test
+    runHook postCheck
+  '';
+  checkInputs = [ uucd ];
+
   meta = with lib; {
     description = "An OCaml library providing efficient access to a selection of character properties of the Unicode character database";
     homepage = webpage;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/visitors/default.nix b/nixpkgs/pkgs/development/ocaml-modules/visitors/default.nix
index bda50bdb78ed..a47cd414fb1e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/visitors/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/visitors/default.nix
@@ -2,18 +2,18 @@
 
 buildDunePackage rec {
   pname = "visitors";
-  version = "20210127";
+  version = "20210316";
 
   useDune2 = true;
 
-  minimumOCamlVersion = "4.07";
+  minimumOCamlVersion = "4.08";
 
   src = fetchFromGitLab {
     owner = "fpottier";
     repo = pname;
     rev = version;
     domain = "gitlab.inria.fr";
-    sha256 = "0b73h7d4yv04a0b5x2i222jknbcgf9vvxzfjxzy2jwanxz9d873z";
+    sha256 = "12d45ncy3g9mpcs6n58aq6yzs5qz662msgcr7ccms9jhiq44m8f7";
   };
 
   propagatedBuildInputs = [ ppxlib ppx_deriving result ];
diff --git a/nixpkgs/pkgs/development/ocaml-modules/wodan/irmin.nix b/nixpkgs/pkgs/development/ocaml-modules/wodan/irmin.nix
index a42259af9e6b..86064d887dbb 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/wodan/irmin.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/wodan/irmin.nix
@@ -15,6 +15,12 @@ buildDunePackage rec {
     wodan
   ];
 
-  meta = wodan.meta // { description = "Wodan as an Irmin store"; };
-
+  meta = wodan.meta // {
+    # wodan is currently incompatible with irmin 2.3.0.
+    # additionally upgrading to current master (unclear
+    # if the issue is fixed there) is not possible as it
+    # depends on a custom fork of mirage-block
+    broken = true;
+    description = "Wodan as an Irmin store";
+  };
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/wtf8/default.nix b/nixpkgs/pkgs/development/ocaml-modules/wtf8/default.nix
index 828df66b41d5..fec6c433604e 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/wtf8/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/wtf8/default.nix
@@ -4,6 +4,8 @@ buildDunePackage rec {
   pname = "wtf8";
   version = "1.0.2";
 
+  useDune2 = true;
+
   minimumOCamlVersion = "4.02";
 
   src = fetchurl {
diff --git a/nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix b/nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix
index c9bf285b7bda..07025be296ce 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/yojson/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchzip, ocaml, findlib, dune, cppo, easy-format, biniou }:
+{ lib, stdenv, fetchzip, ocaml, findlib, dune_2, cppo, easy-format, biniou }:
 let
   pname = "yojson";
   param =
@@ -6,7 +6,7 @@ let
     version = "1.7.0";
     url = "https://github.com/ocaml-community/yojson/releases/download/${version}/yojson-${version}.tbz";
     sha256 = "08llz96if8bcgnaishf18si76cv11zbkni0aldb54k3cn7ipiqvd";
-    nativeBuildInputs = [ dune ];
+    nativeBuildInputs = [ dune_2 ];
     extra = {
       installPhase = ''
         dune install --prefix $out --libdir $OCAMLFIND_DESTDIR ${pname}
diff --git a/nixpkgs/pkgs/development/ocaml-modules/zarith/default.nix b/nixpkgs/pkgs/development/ocaml-modules/zarith/default.nix
index bddf2a2448fd..eed6b158d4a6 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/zarith/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/zarith/default.nix
@@ -1,31 +1,26 @@
-{ lib, stdenv, fetchurl
-, ocaml, findlib, pkg-config, perl
+{ lib, stdenv, fetchFromGitHub
+, ocaml, findlib, pkg-config
 , gmp
 }:
 
-let source =
-  if lib.versionAtLeast ocaml.version "4.02"
-  then {
-    version = "1.11";
-    url = "https://github.com/ocaml/Zarith/archive/release-1.11.tar.gz";
-    sha256 = "111n33flg4aq5xp5jfksqm4yyz6mzxx9ps9a4yl0dz8h189az5pr";
-  } else {
-    version = "1.3";
-    url = "http://forge.ocamlcore.org/frs/download.php/1471/zarith-1.3.tgz";
-    sha256 = "1mx3nxcn5h33qhx4gbg0hgvvydwlwdvdhqcnvfwnmf9jy3b8frll";
-  };
-in
+if !lib.versionAtLeast ocaml.version "4.04"
+then throw "zarith is not available for OCaml ${ocaml.version}"
+else
 
 stdenv.mkDerivation rec {
-  name = "ocaml${ocaml.version}-zarith-${version}";
-  inherit (source) version;
-  src = fetchurl { inherit (source) url sha256; };
+  pname = "ocaml${ocaml.version}-zarith";
+  version = "1.12";
+  src = fetchFromGitHub {
+    owner = "ocaml";
+    repo = "Zarith";
+    rev = "release-${version}";
+    sha256 = "1jslm1rv1j0ya818yh23wf3bb6hz7qqj9pn5fwl45y9mqyqa01s9";
+  };
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml findlib perl ];
+  buildInputs = [ ocaml findlib ];
   propagatedBuildInputs = [ gmp ];
 
-  patchPhase = "patchShebangs ./z_pp.pl";
   dontAddPrefix = true;
   configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ];