summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/containers/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/containers/default.nix')
-rw-r--r--pkgs/development/ocaml-modules/containers/default.nix30
1 files changed, 26 insertions, 4 deletions
diff --git a/pkgs/development/ocaml-modules/containers/default.nix b/pkgs/development/ocaml-modules/containers/default.nix
index 8a03098d84b..4a3ed5723dd 100644
--- a/pkgs/development/ocaml-modules/containers/default.nix
+++ b/pkgs/development/ocaml-modules/containers/default.nix
@@ -1,6 +1,14 @@
-{ stdenv, fetchFromGitHub, ocaml, findlib, cppo, gen, sequence, qtest, ounit }:
+{ stdenv, fetchFromGitHub, ocaml, findlib, cppo, gen, sequence, qtest, ounit, ocaml_oasis, result }:
 
-let version = "0.15"; in
+let
+
+  mkpath = p:
+    let v = stdenv.lib.getVersion ocaml; in
+      "${p}/lib/ocaml/${v}/site-lib";
+
+  version = "0.16";
+
+in
 
 stdenv.mkDerivation {
   name = "ocaml-containers-${version}";
@@ -9,10 +17,24 @@ stdenv.mkDerivation {
     owner = "c-cube";
     repo = "ocaml-containers";
     rev = "${version}";
-    sha256 = "13mdl8jp4ymg1wip7lqmh4224x4jnji3frm1ik55vvm3ac8caqng";
+    sha256 = "1mc33b4nvn9k3r4k56amxr804bg5ndhxv92cmjzg5pf4qh220c2h";
   };
 
-  buildInputs = [ ocaml findlib cppo gen sequence qtest ounit ];
+  buildInputs = [ ocaml findlib cppo gen sequence qtest ounit ocaml_oasis ];
+
+  propagatedBuildInputs = [ result ];
+
+  preConfigure = ''
+    # The following is done so that the '#use "topfind"' directive works in the ocaml top-level
+    export HOME="$(mktemp -d)"
+    export OCAML_TOPLEVEL_PATH="${mkpath findlib}"
+    cat <<EOF > $HOME/.ocamlinit
+let () =
+  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
+  with Not_found -> ()
+;;
+EOF
+  '';
 
   configureFlags = [
     "--enable-unix"