summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules')
-rw-r--r--pkgs/development/ocaml-modules/batteries/default.nix13
-rw-r--r--pkgs/development/ocaml-modules/cstruct/1.9.0.nix36
-rw-r--r--pkgs/development/ocaml-modules/cstruct/default.nix50
-rw-r--r--pkgs/development/ocaml-modules/cstruct/lwt.nix12
-rw-r--r--pkgs/development/ocaml-modules/cstruct/ppx.nix13
-rw-r--r--pkgs/development/ocaml-modules/cstruct/unix.nix12
-rw-r--r--pkgs/development/ocaml-modules/nocrypto/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/ocaml-gettext/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/otr/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ppx_deriving/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/ppx_import/default.nix8
-rw-r--r--pkgs/development/ocaml-modules/rope/default.nix38
-rw-r--r--pkgs/development/ocaml-modules/sqlexpr/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/tls/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/x509/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/yojson/default.nix32
17 files changed, 169 insertions, 86 deletions
diff --git a/pkgs/development/ocaml-modules/batteries/default.nix b/pkgs/development/ocaml-modules/batteries/default.nix
index 7c8dc08c4888..e71496e84f04 100644
--- a/pkgs/development/ocaml-modules/batteries/default.nix
+++ b/pkgs/development/ocaml-modules/batteries/default.nix
@@ -1,18 +1,21 @@
-{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, qtest }:
+{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, qtest, num }:
 
-let version = "2.7.0"; in
+let version = "2.8.0"; in
 
 stdenv.mkDerivation {
-  name = "ocaml-batteries-${version}";
+  name = "ocaml${ocaml.version}-batteries-${version}";
 
   src = fetchzip {
     url = "https://github.com/ocaml-batteries-team/batteries-included/archive/v${version}.tar.gz";
-    sha256 = "02rgfylz6x4y2030cclf9zwk2i8xqsydn1y9hjkja2qsk895bwfb";
+    sha256 = "1cvgljg8lxvfx0v3367z3p43dysg9m33v8gfy43bhw7fjr1bmyas";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild qtest ];
+  propagatedBuildInputs = [ num ];
 
-  configurePhase = "true"; 	# Skip configure
+  configurePhase = if num != null then ''
+    export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}${num}/lib/ocaml/${ocaml.version}/site-lib/stublibs/"
+  '' else "true";      # Skip configure
 
   doCheck = true;
   checkTarget = "test test";
diff --git a/pkgs/development/ocaml-modules/cstruct/1.9.0.nix b/pkgs/development/ocaml-modules/cstruct/1.9.0.nix
new file mode 100644
index 000000000000..25f84826ec18
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/1.9.0.nix
@@ -0,0 +1,36 @@
+{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
+, async ? null, lwt ? null
+}:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
+
+let version = "1.9.0"; in
+
+let opt = b: "--${if b != null then "en" else "dis"}able"; in
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-cstruct-${version}";
+
+  src = fetchFromGitHub {
+    owner = "mirage";
+    repo = "ocaml-cstruct";
+    rev = "v${version}";
+    sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy";
+  };
+
+  configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
+
+  buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
+  propagatedBuildInputs = [ ocplib-endian sexplib ];
+
+  createFindlibDestdir = true;
+  dontStrip = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/mirage/ocaml-cstruct;
+    description = "Map OCaml arrays onto C-like structs";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
+    platforms = ocaml.meta.platforms or [];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/default.nix b/pkgs/development/ocaml-modules/cstruct/default.nix
index 0278b0f26558..976ff697c98f 100644
--- a/pkgs/development/ocaml-modules/cstruct/default.nix
+++ b/pkgs/development/ocaml-modules/cstruct/default.nix
@@ -1,40 +1,28 @@
-{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
-, async ? null, lwt ? null
-}:
-
-assert stdenv.lib.versionAtLeast ocaml.version "4.01";
-
-let param =
-  if stdenv.lib.versionAtLeast ocaml.version "4.02"
-  then { version = "2.3.2"; sha256 = "1fykack86hvvqhwngddyxxqlwm3xjljfaszsjbdrvjlrd1nlg079"; }
-  else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
-in
-
-let opt = b: "--${if b != null then "en" else "dis"}able"; in
+{ stdenv, fetchurl, ocaml, jbuilder, findlib, sexplib, ocplib-endian }:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-cstruct-${version}";
+  version = "3.0.2";
+  src = fetchurl {
+    url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-${version}.tbz";
+    sha256 = "03caxcyzfjmbnnwa15zy9s1ckkl4sc834d1qkgi4jcs3zqchvd8z";
+  };
 
-stdenv.mkDerivation {
-  name = "ocaml${ocaml.version}-cstruct-${param.version}";
+  unpackCmd = "tar -xjf $curSrc";
 
-  src = fetchFromGitHub {
-    owner = "mirage";
-    repo = "ocaml-cstruct";
-    rev = "v${param.version}";
-    inherit (param) sha256;
-  };
+  buildInputs = [ ocaml jbuilder findlib ];
 
-  configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
+  propagatedBuildInputs = [ sexplib ocplib-endian ];
 
-  buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
-  propagatedBuildInputs = [ ocplib-endian sexplib ];
+  buildPhase = "jbuilder build -p cstruct";
 
-  createFindlibDestdir = true;
-  dontStrip = true;
+  inherit (jbuilder) installPhase;
 
-  meta = with stdenv.lib; {
-    homepage = https://github.com/mirage/ocaml-cstruct;
-    description = "Map OCaml arrays onto C-like structs";
+  meta = {
+    description = "Access C-like structures directly from OCaml";
     license = stdenv.lib.licenses.isc;
-    maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
-    platforms = ocaml.meta.platforms or [];
+    homepage = "https://github.com/mirage/ocaml-cstruct";
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
   };
 }
diff --git a/pkgs/development/ocaml-modules/cstruct/lwt.nix b/pkgs/development/ocaml-modules/cstruct/lwt.nix
new file mode 100644
index 000000000000..065716e68529
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/lwt.nix
@@ -0,0 +1,12 @@
+{ stdenv, ocaml, cstruct, lwt }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-cstruct-lwt-${version}";
+	inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
+
+	propagatedBuildInputs = [ cstruct lwt ];
+
+	buildPhase = "${cstruct.buildPhase}-lwt";
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/ppx.nix b/pkgs/development/ocaml-modules/cstruct/ppx.nix
new file mode 100644
index 000000000000..9d19e1751e23
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/ppx.nix
@@ -0,0 +1,13 @@
+{ stdenv, ocaml, cstruct, ppx_tools_versioned }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-ppx_cstruct-${version}";
+	inherit (cstruct) version src unpackCmd installPhase meta;
+
+	buildInputs = cstruct.buildInputs ++ [ ppx_tools_versioned ];
+	propagatedBuildInputs = [ cstruct ];
+
+	buildPhase = "jbuilder build -p ppx_cstruct";
+}
diff --git a/pkgs/development/ocaml-modules/cstruct/unix.nix b/pkgs/development/ocaml-modules/cstruct/unix.nix
new file mode 100644
index 000000000000..2a614579fccc
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cstruct/unix.nix
@@ -0,0 +1,12 @@
+{ stdenv, ocaml, cstruct }:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-cstruct-unix-${version}";
+	inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
+
+	propagatedBuildInputs = [ cstruct ];
+
+	buildPhase = "${cstruct.buildPhase}-unix";
+}
diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix
index c68584957c66..a7fa59e14469 100644
--- a/pkgs/development/ocaml-modules/nocrypto/default.nix
+++ b/pkgs/development/ocaml-modules/nocrypto/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg
 , cpuid, ocb-stubblr
 , cstruct, zarith, ppx_sexp_conv, sexplib
-, lwt ? null
+, cstruct-lwt ? null
 }:
 
 with stdenv.lib;
-let withLwt = lwt != null; in
+let withLwt = cstruct-lwt != null; in
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-nocrypto-${version}";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ ocaml findlib ocamlbuild topkg opam cpuid ocb-stubblr
     ppx_sexp_conv ];
-  propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt lwt;
+  propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt cstruct-lwt;
 
   buildPhase = ''
     LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
diff --git a/pkgs/development/ocaml-modules/ocaml-gettext/default.nix b/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
index a2bbe6960cf7..014525ef2b4e 100644
--- a/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
+++ b/pkgs/development/ocaml-modules/ocaml-gettext/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-gettext-${version}";
-  version = "0.3.7";
+  version = "0.3.8";
 
   src = fetchurl {
-    url = "https://forge.ocamlcore.org/frs/download.php/1678/ocaml-gettext-${version}.tar.gz";
-    sha256 = "1zhvzc9x3j57xf2mzg5rshgp14cb4dsqbnj52jjv1qnja97plyjp";
+    url = "https://forge.ocamlcore.org/frs/download.php/1731/ocaml-gettext-${version}.tar.gz";
+    sha256 = "05wnpxwzzpn2qinah2wb5wzfh5iz8gyf8jyihdbjxc8mk4hf70qv";
   };
 
   propagatedBuildInputs = [ gettext fileutils camomile ];
diff --git a/pkgs/development/ocaml-modules/otr/default.nix b/pkgs/development/ocaml-modules/otr/default.nix
index dfee365cd750..39e7ce754d27 100644
--- a/pkgs/development/ocaml-modules/otr/default.nix
+++ b/pkgs/development/ocaml-modules/otr/default.nix
@@ -1,5 +1,5 @@
 {stdenv, buildOcaml, fetchFromGitHub, ocamlbuild, findlib, topkg, ocaml, opam,
- ppx_tools, ppx_sexp_conv, cstruct, sexplib, result, nocrypto, astring}:
+ ppx_tools, ppx_sexp_conv, cstruct, ppx_cstruct, sexplib, result, nocrypto, astring}:
 
 let ocamlFlags = "-I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/"; in
 
@@ -16,7 +16,7 @@ buildOcaml rec {
     sha256 = "07zzix5mfsasqpqdx811m0x04gp8mq1ayf4b64998k98027v01rr";
   };
 
-  buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ];
+  buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ppx_cstruct ];
   propagatedBuildInputs = [ cstruct sexplib result nocrypto astring ];
 
   buildPhase = ''
diff --git a/pkgs/development/ocaml-modules/ppx_deriving/default.nix b/pkgs/development/ocaml-modules/ppx_deriving/default.nix
index 1b209e523699..3afe4149fa34 100644
--- a/pkgs/development/ocaml-modules/ppx_deriving/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_deriving/default.nix
@@ -9,8 +9,8 @@ let param =
     sha256 = "0cy9p8d8cbcxvqyyv8fz2z9ypi121zrgaamdlp4ld9f3jnwz7my9";
     extraPropagatedBuildInputs = [];
   } else {
-    version = "4.2";
-    sha256 = "0scsg45wp6xdqj648fz155r4yngyl2xcd3hdszfzqwdpbax33914";
+    version = "4.2.1";
+    sha256 = "1yhhjnncbbb7fsif7qplndh01s1xd72dqm8f3jkgx9y4ariqqvf9";
     extraPropagatedBuildInputs = [ ocaml-migrate-parsetree ppx_derivers ];
 }; in
 
diff --git a/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix b/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix
index 5874f5eb884c..10f9df04f38c 100644
--- a/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix
@@ -4,13 +4,13 @@
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-ppx_deriving_yojson-${version}";
-  version = "3.0";
+  version = "3.1";
 
   src = fetchFromGitHub {
-    owner = "whitequark";
+    owner = "ocaml-ppx";
     repo = "ppx_deriving_yojson";
     rev = "v${version}";
-    sha256 = "1id1a29qq0ax9qp98b5hv6p2q2r0vp4fbkkwzm1bxdhnasw97msk";
+    sha256 = "1pwfnq7z60nchba4gnf58918ll11w3gj5i88qhz1p2jm45hxqgnw";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild opam cppo ounit ppx_import ];
@@ -28,6 +28,5 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.mit;
     maintainers = [ stdenv.lib.maintainers.vbgl ];
     inherit (ocaml.meta) platforms;
-    broken = stdenv.lib.versionAtLeast ocaml.version "4.05";
   };
 }
diff --git a/pkgs/development/ocaml-modules/ppx_import/default.nix b/pkgs/development/ocaml-modules/ppx_import/default.nix
index 245fe3f76f66..991af1e41de1 100644
--- a/pkgs/development/ocaml-modules/ppx_import/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_import/default.nix
@@ -4,15 +4,15 @@
 buildOcaml rec {
   name = "ppx_import";
 
-  version = "1.1";
+  version = "1.4";
 
   minimumSupportedOcamlVersion = "4.02";
 
   src = fetchFromGitHub {
-    owner = "whitequark";
+    owner = "ocaml-ppx";
     repo = "ppx_import";
     rev = "v${version}";
-    sha256 = "1hfvbc81dg58q7kkpn808b3j0xazrqfrr4v71sd1yvmnk71wak6k";
+    sha256 = "14c2lp7r9080c4hsb1y1drbxxx3v44b7ib5wfh3kkh3f1jfsjwbk";
   };
 
   buildInputs = [ cppo ounit ppx_deriving opam ];
@@ -29,4 +29,4 @@ buildOcaml rec {
     description = "A syntax extension that allows to pull in types or signatures from other compiled interface files";
     license = licenses.mit;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/ocaml-modules/rope/default.nix b/pkgs/development/ocaml-modules/rope/default.nix
index a62c321a4e83..dfb8c56c23e8 100644
--- a/pkgs/development/ocaml-modules/rope/default.nix
+++ b/pkgs/development/ocaml-modules/rope/default.nix
@@ -1,18 +1,34 @@
-{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, benchmark }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, jbuilder, benchmark }:
 
-let version = "0.5"; in
+let param =
+  if stdenv.lib.versionAtLeast ocaml.version "4.03"
+  then {
+    version = "0.6";
+    url = " https://github.com/Chris00/ocaml-rope/releases/download/0.6/rope-0.6.tbz";
+    sha256 = "06pkbnkad2ck50jn59ggwv154yd9vb01abblihvam6p27m4za1pc";
+    buildInputs = [ jbuilder ];
+    extra = {
+      unpackCmd = "tar -xjf $curSrc";
+      buildPhase = "jbuilder build -p rope";
+      inherit (jbuilder) installPhase;
+    };
+  } else {
+    version = "0.5";
+    url = "https://forge.ocamlcore.org/frs/download.php/1156/rope-0.5.tar.gz";
+    sha256 = "05fr2f5ch2rqhyaj06rv5218sbg99p1m9pq5sklk04hpslxig21f";
+    buildInputs = [ ocamlbuild ];
+    extra = { createFindlibDestdir = true; };
+  };
+in
 
-stdenv.mkDerivation {
-  name = "ocaml${ocaml.version}-rope-${version}";
+stdenv.mkDerivation ({
+  name = "ocaml${ocaml.version}-rope-${param.version}";
 
-  src = fetchzip {
-    url = "https://forge.ocamlcore.org/frs/download.php/1156/rope-${version}.tar.gz";
-    sha256 = "1i8kzg19jrapl30mq8m91vy09z0r0dl4bnpw24ga96w8pxqf9qhd";
+  src = fetchurl {
+    inherit (param) url sha256;
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild benchmark ];
-
-  createFindlibDestdir = true;
+  buildInputs = [ ocaml findlib benchmark ] ++ param.buildInputs;
 
   meta = {
     homepage = http://rope.forge.ocamlcore.org/;
@@ -21,4 +37,4 @@ stdenv.mkDerivation {
     license = stdenv.lib.licenses.lgpl21;
     maintainers = with stdenv.lib.maintainers; [ volth ];
   };
-}
+} // param.extra)
diff --git a/pkgs/development/ocaml-modules/sqlexpr/default.nix b/pkgs/development/ocaml-modules/sqlexpr/default.nix
index 6d1654f2b42f..363d5850ec60 100644
--- a/pkgs/development/ocaml-modules/sqlexpr/default.nix
+++ b/pkgs/development/ocaml-modules/sqlexpr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildOcaml, fetchurl, ocaml_batteries, csv, ocaml_lwt, ocaml_sqlite3, estring }:
+{ stdenv, buildOcaml, fetchurl, batteries, csv, ocaml_lwt, ocaml_sqlite3, estring }:
 
 buildOcaml rec {
   name = "sqlexpr";
@@ -9,7 +9,7 @@ buildOcaml rec {
     sha256 = "02pi0xxr3xzalwpvcaq96k57wz2vxj20l2mga1a4d2ddvhran8kr";
   };
 
-  propagatedBuildInputs = [ ocaml_batteries csv ocaml_lwt ocaml_sqlite3 estring ];
+  propagatedBuildInputs = [ batteries csv ocaml_lwt ocaml_sqlite3 estring ];
 
   meta = with stdenv.lib; {
     homepage = https://github.com/mfp/ocaml-sqlexpr;
diff --git a/pkgs/development/ocaml-modules/tls/default.nix b/pkgs/development/ocaml-modules/tls/default.nix
index b38138c55731..8c146102ad1b 100644
--- a/pkgs/development/ocaml-modules/tls/default.nix
+++ b/pkgs/development/ocaml-modules/tls/default.nix
@@ -1,5 +1,5 @@
 { stdenv, buildOcaml, fetchFromGitHub, findlib, ocamlbuild, ocaml_oasis
-, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ounit
+, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ppx_cstruct, cstruct-unix, ounit
 , lwt     ? null}:
 
 with stdenv.lib;
@@ -19,7 +19,7 @@ buildOcaml rec {
     sha256 = "19q2hzxiasz9pzczgb63kikg0mc9mw98dfvch5falf2rincycj24";
   };
 
-  buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ];
+  buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
   propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
                           optional withLwt lwt;
 
diff --git a/pkgs/development/ocaml-modules/x509/default.nix b/pkgs/development/ocaml-modules/x509/default.nix
index ab82f6abdcbb..316035b40543 100644
--- a/pkgs/development/ocaml-modules/x509/default.nix
+++ b/pkgs/development/ocaml-modules/x509/default.nix
@@ -1,4 +1,6 @@
-{stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto, ounit, ocaml_oasis, ppx_sexp_conv}:
+{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto
+, ounit, ocaml_oasis, ppx_sexp_conv, cstruct-unix
+}:
 
 buildOcaml rec {
   name = "x509";
@@ -13,7 +15,7 @@ buildOcaml rec {
     sha256 = "07cc3z6h87460z3f4vz8nlczw5jkc4vjhix413z9x6nral876rn7";
   };
 
-  buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv ];
+  buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv cstruct-unix ];
   propagatedBuildInputs = [ asn1-combinators nocrypto ];
 
   configureFlags = "--enable-tests";
diff --git a/pkgs/development/ocaml-modules/yojson/default.nix b/pkgs/development/ocaml-modules/yojson/default.nix
index 2ce2faa7e8d6..5d751d3dc997 100644
--- a/pkgs/development/ocaml-modules/yojson/default.nix
+++ b/pkgs/development/ocaml-modules/yojson/default.nix
@@ -1,16 +1,26 @@
-{ stdenv, fetchzip, ocaml, findlib, cppo, easy-format, biniou }:
+{ stdenv, fetchzip, ocaml, findlib, jbuilder, cppo, easy-format, biniou }:
 let
   pname = "yojson";
   param =
-  if stdenv.lib.versionAtLeast ocaml.version "4.01" then {
-    version = "1.3.3";
-    sha256 = "02l11facbr6bxrxq95vrcp1dxapp02kv7g4gq8rm62pb3dj5c6g7";
+  if stdenv.lib.versionAtLeast ocaml.version "4.02" then {
+    version = "1.4.0";
+    sha256 = "0rzn4yihfi0psd2qmgrx5fvwpby87sqx4zws3ijf49f7wbpycccv";
+    buildInputs = [ jbuilder ];
+    extra = { inherit (jbuilder) installPhase; };
   } else {
     version = "1.2.3";
     sha256 = "10dvkndgwanvw4agbjln7kgb1n9s6lii7jw82kwxczl5rd1sgmvl";
+    buildInputs = [];
+    extra = {
+      createFindlibDestdir = true;
+
+      makeFlags = "PREFIX=$(out)";
+
+      preBuild = "mkdir $out/bin";
+    };
   };
 in
-stdenv.mkDerivation {
+stdenv.mkDerivation ({
 
   name = "ocaml${ocaml.version}-${pname}-${param.version}";
 
@@ -19,18 +29,10 @@ stdenv.mkDerivation {
     inherit (param) sha256;
   };
 
-  buildInputs = [ ocaml findlib ];
+  buildInputs = [ ocaml findlib ] ++ param.buildInputs;
 
   propagatedBuildInputs = [ cppo easy-format biniou ];
 
-  createFindlibDestdir = true;
-
-  makeFlags = "PREFIX=$(out)";
-
-  preBuild = ''
-    mkdir $out/bin
-  '';
-
   meta = with stdenv.lib; {
     description = "An optimized parsing and printing library for the JSON format";
     homepage = "http://mjambon.com/${pname}.html";
@@ -38,4 +40,4 @@ stdenv.mkDerivation {
     maintainers = [ maintainers.vbgl ];
     platforms = ocaml.meta.platforms or [];
   };
-}
+} // param.extra)