about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules
diff options
context:
space:
mode:
authorVincent Laporte <Vincent.Laporte@gmail.com>2016-11-12 10:17:30 +0100
committerVincent Laporte <Vincent.Laporte@gmail.com>2016-11-12 12:41:27 +0100
commit2d136204c47985c9518105e1af9e14810c8319ec (patch)
tree75c813173f2af5baf66bed2227a930d88e7c0ed1 /pkgs/development/ocaml-modules
parent72c1a6f0f46cf4e35986b49f957f690922ba7a02 (diff)
ocamlPackages.cstruct: 1.6.0 -> 1.9.0, 2.3.0
Diffstat (limited to 'pkgs/development/ocaml-modules')
-rw-r--r--pkgs/development/ocaml-modules/cstruct/default.nix33
-rw-r--r--pkgs/development/ocaml-modules/nocrypto/default.nix4
2 files changed, 24 insertions, 13 deletions
diff --git a/pkgs/development/ocaml-modules/cstruct/default.nix b/pkgs/development/ocaml-modules/cstruct/default.nix
index c9f04918d1726..dd6cffb979c57 100644
--- a/pkgs/development/ocaml-modules/cstruct/default.nix
+++ b/pkgs/development/ocaml-modules/cstruct/default.nix
@@ -1,20 +1,31 @@
-{stdenv, writeText, fetchurl, ocaml, ocplib-endian, sexplib_p4, findlib,
- async_p4 ? null, lwt ? null, camlp4}:
+{ stdenv, writeText, fetchFromGitHub, ocaml, ocplib-endian, sexplib_p4, findlib, ppx_tools
+, async_p4 ? null, lwt ? null, camlp4
+}:
 
-assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01";
+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
+
+let param =
+  if stdenv.lib.versionAtLeast ocaml.version "4.02"
+  then { version = "2.3.0"; sha256 = "19spsgkry41dhsbm6ij71kws90bqp7wiggc6lsqdl43xxvbgdmys"; }
+  else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
+in
+
+let opt = b: "--${if b != null then "en" else "dis"}able"; in
 
 stdenv.mkDerivation {
-  name = "ocaml-cstruct-1.6.0";
+  name = "ocaml${ocaml.version}-cstruct-${param.version}";
 
-  src = fetchurl {
-    url = https://github.com/mirage/ocaml-cstruct/archive/v1.6.0.tar.gz;
-    sha256 = "0f90a1b7a03091cf22a3ccb11a0cce03b6500f064ad3766b5ed81418ac008ece";
+  src = fetchFromGitHub {
+    owner = "mirage";
+    repo = "ocaml-cstruct";
+    rev = "v${param.version}";
+    inherit (param) sha256;
   };
 
-  configureFlags = stdenv.lib.strings.concatStringsSep " " ((if lwt != null then ["--enable-lwt"] else []) ++
-                                          (if async_p4 != null then ["--enable-async"] else []));
-  buildInputs = [ocaml findlib camlp4];
-  propagatedBuildInputs = [ocplib-endian sexplib_p4 lwt async_p4];
+  configureFlags = [ "${opt lwt}-lwt" "${opt async_p4}-async" "${opt ppx_tools}-ppx" ];
+
+  buildInputs = [ ocaml findlib ppx_tools camlp4 lwt async_p4 ];
+  propagatedBuildInputs = [ ocplib-endian sexplib_p4 ];
 
   createFindlibDestdir = true;
   dontStrip = true;
diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix
index f8db935b61228..fab048a9a9f8b 100644
--- a/pkgs/development/ocaml-modules/nocrypto/default.nix
+++ b/pkgs/development/ocaml-modules/nocrypto/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchzip, ocaml, findlib, cstruct, type_conv, zarith, ounit }:
+{ stdenv, fetchzip, ocaml, findlib, cstruct, type_conv, zarith, ocaml_lwt, ounit }:
 
 assert stdenv.lib.versionAtLeast ocaml.version "4.01";
 
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "15gffvixk12ghsfra9amfszd473c8h188zfj03ngvblbdm0d80m0";
   };
 
-  buildInputs = [ ocaml findlib type_conv ounit ];
+  buildInputs = [ ocaml findlib type_conv ocaml_lwt ounit ];
   propagatedBuildInputs = [ cstruct zarith ];
 
   configureFlags = "--enable-tests";