git.iko.soy/typeable/nixpkgs
on master help sign in
ocamlPackages.cstruct: 2.3.2 -> 3.0.2
bfc0959Vincent Laporte
pkgs/development/ocaml-modules/cstruct/1.9.0.nixnew file+36
@@ -0,0 +1,36 @@
1+{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
2+, async ? null, lwt ? null
3+}:
4+
5+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
6+
7+let version = "1.9.0"; in
8+
9+let opt = b: "--${if b != null then "en" else "dis"}able"; in
10+
11+stdenv.mkDerivation {
12+ name = "ocaml${ocaml.version}-cstruct-${version}";
13+
14+ src = fetchFromGitHub {
15+ owner = "mirage";
16+ repo = "ocaml-cstruct";
17+ rev = "v${version}";
18+ sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy";
19+ };
20+
21+ configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
22+
23+ buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
24+ propagatedBuildInputs = [ ocplib-endian sexplib ];
25+
26+ createFindlibDestdir = true;
27+ dontStrip = true;
28+
29+ meta = with stdenv.lib; {
30+ homepage = https://github.com/mirage/ocaml-cstruct;
31+ description = "Map OCaml arrays onto C-like structs";
32+ license = stdenv.lib.licenses.isc;
33+ maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
34+ platforms = ocaml.meta.platforms or [];
35+ };
36+}
pkgs/development/ocaml-modules/cstruct/default.nix+20−32
@@ -1,40 +1,28 @@
1−{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
1+{ stdenv, fetchurl, ocaml, jbuilder, findlib, sexplib, ocplib-endian }:
2−, async ? null, lwt ? null
3−}:
4
2
5−assert stdenv.lib.versionAtLeast ocaml.version "4.01";
3+stdenv.mkDerivation rec {
4+ name = "ocaml${ocaml.version}-cstruct-${version}";
5+ version = "3.0.2";
6+ src = fetchurl {
7+ url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-${version}.tbz";
8+ sha256 = "03caxcyzfjmbnnwa15zy9s1ckkl4sc834d1qkgi4jcs3zqchvd8z";
9+ };
6
10
7−let param =
11+ unpackCmd = "tar -xjf $curSrc";
8− if stdenv.lib.versionAtLeast ocaml.version "4.02"
9− then { version = "2.3.2"; sha256 = "1fykack86hvvqhwngddyxxqlwm3xjljfaszsjbdrvjlrd1nlg079"; }
10− else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
11−in
12
12
13−let opt = b: "--${if b != null then "en" else "dis"}able"; in
13+ buildInputs = [ ocaml jbuilder findlib ];
14
14
15−stdenv.mkDerivation {
15+ propagatedBuildInputs = [ sexplib ocplib-endian ];
16− name = "ocaml${ocaml.version}-cstruct-${param.version}";
17
16
18− src = fetchFromGitHub {
17+ buildPhase = "jbuilder build -p cstruct";
19− owner = "mirage";
20− repo = "ocaml-cstruct";
21− rev = "v${param.version}";
22− inherit (param) sha256;
23− };
24
18
25− configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
19+ inherit (jbuilder) installPhase;
26
20
27− buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
21+ meta = {
28− propagatedBuildInputs = [ ocplib-endian sexplib ];
22+ description = "Access C-like structures directly from OCaml";
29−
30− createFindlibDestdir = true;
31− dontStrip = true;
32−
33− meta = with stdenv.lib; {
34− homepage = https://github.com/mirage/ocaml-cstruct;
35− description = "Map OCaml arrays onto C-like structs";
36− license = stdenv.lib.licenses.isc;
23+ license = stdenv.lib.licenses.isc;
37− maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
24+ maintainers = [ stdenv.lib.maintainers.vbgl ];
38− platforms = ocaml.meta.platforms or [];
25+ inherit (src.meta) homepage;
26+ inherit (ocaml.meta) platforms;
39− };
27+ };
40}
28}
pkgs/development/ocaml-modules/cstruct/lwt.nixnew file+12
@@ -0,0 +1,12 @@
1+{ stdenv, ocaml, cstruct, lwt }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-cstruct-lwt-${version}";
7+ inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
8+
9+ propagatedBuildInputs = [ cstruct lwt ];
10+
11+ buildPhase = "${cstruct.buildPhase}-lwt";
12+}
pkgs/development/ocaml-modules/cstruct/ppx.nixnew file+13
@@ -0,0 +1,13 @@
1+{ stdenv, ocaml, cstruct, ppx_tools_versioned }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-ppx_cstruct-${version}";
7+ inherit (cstruct) version src unpackCmd installPhase meta;
8+
9+ buildInputs = cstruct.buildInputs ++ [ ppx_tools_versioned ];
10+ propagatedBuildInputs = [ cstruct ];
11+
12+ buildPhase = "jbuilder build -p ppx_cstruct";
13+}
pkgs/development/ocaml-modules/cstruct/unix.nixnew file+12
@@ -0,0 +1,12 @@
1+{ stdenv, ocaml, cstruct }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-cstruct-unix-${version}";
7+ inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
8+
9+ propagatedBuildInputs = [ cstruct ];
10+
11+ buildPhase = "${cstruct.buildPhase}-unix";
12+}
pkgs/development/ocaml-modules/nocrypto/default.nix+3−3
@@ -1,11 +1,11 @@
1{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg
1{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg
2, cpuid, ocb-stubblr
2, cpuid, ocb-stubblr
3, cstruct, zarith, ppx_sexp_conv, sexplib
3, cstruct, zarith, ppx_sexp_conv, sexplib
4−, lwt ? null
4+, cstruct-lwt ? null
5}:
5}:
6
6
7with stdenv.lib;
7with stdenv.lib;
8−let withLwt = lwt != null; in
8+let withLwt = cstruct-lwt != null; in
9
9
10stdenv.mkDerivation rec {
10stdenv.mkDerivation rec {
11 name = "ocaml${ocaml.version}-nocrypto-${version}";
11 name = "ocaml${ocaml.version}-nocrypto-${version}";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
20
20
21 buildInputs = [ ocaml findlib ocamlbuild topkg opam cpuid ocb-stubblr
21 buildInputs = [ ocaml findlib ocamlbuild topkg opam cpuid ocb-stubblr
22 ppx_sexp_conv ];
22 ppx_sexp_conv ];
23− propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt lwt;
23+ propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt cstruct-lwt;
24
24
25 buildPhase = ''
25 buildPhase = ''
26 LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
26 LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
pkgs/development/ocaml-modules/otr/default.nix+2−2
@@ -1,5 +1,5 @@
1{stdenv, buildOcaml, fetchFromGitHub, ocamlbuild, findlib, topkg, ocaml, opam,
1{stdenv, buildOcaml, fetchFromGitHub, ocamlbuild, findlib, topkg, ocaml, opam,
2− ppx_tools, ppx_sexp_conv, cstruct, sexplib, result, nocrypto, astring}:
2+ ppx_tools, ppx_sexp_conv, cstruct, ppx_cstruct, sexplib, result, nocrypto, astring}:
3
3
4let ocamlFlags = "-I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/"; in
4let ocamlFlags = "-I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/"; in
5
5
@@ -16,7 +16,7 @@ buildOcaml rec {
16 sha256 = "07zzix5mfsasqpqdx811m0x04gp8mq1ayf4b64998k98027v01rr";
16 sha256 = "07zzix5mfsasqpqdx811m0x04gp8mq1ayf4b64998k98027v01rr";
17 };
17 };
18
18
19− buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ];
19+ buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ppx_cstruct ];
20 propagatedBuildInputs = [ cstruct sexplib result nocrypto astring ];
20 propagatedBuildInputs = [ cstruct sexplib result nocrypto astring ];
21
21
22 buildPhase = ''
22 buildPhase = ''
pkgs/development/ocaml-modules/tls/default.nix+2−2
@@ -1,5 +1,5 @@
1{ stdenv, buildOcaml, fetchFromGitHub, findlib, ocamlbuild, ocaml_oasis
1{ stdenv, buildOcaml, fetchFromGitHub, findlib, ocamlbuild, ocaml_oasis
2−, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ounit
2+, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ppx_cstruct, cstruct-unix, ounit
3, lwt ? null}:
3, lwt ? null}:
4
4
5with stdenv.lib;
5with stdenv.lib;
@@ -19,7 +19,7 @@ buildOcaml rec {
19 sha256 = "19q2hzxiasz9pzczgb63kikg0mc9mw98dfvch5falf2rincycj24";
19 sha256 = "19q2hzxiasz9pzczgb63kikg0mc9mw98dfvch5falf2rincycj24";
20 };
20 };
21
21
22− buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ];
22+ buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
23 propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
23 propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
24 optional withLwt lwt;
24 optional withLwt lwt;
25
25
pkgs/development/ocaml-modules/x509/default.nix+4−2
@@ -1,4 +1,6 @@
1−{stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto, ounit, ocaml_oasis, ppx_sexp_conv}:
1+{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto
2+, ounit, ocaml_oasis, ppx_sexp_conv, cstruct-unix
3+}:
2
4
3buildOcaml rec {
5buildOcaml rec {
4 name = "x509";
6 name = "x509";
@@ -13,7 +15,7 @@ buildOcaml rec {
13 sha256 = "07cc3z6h87460z3f4vz8nlczw5jkc4vjhix413z9x6nral876rn7";
15 sha256 = "07cc3z6h87460z3f4vz8nlczw5jkc4vjhix413z9x6nral876rn7";
14 };
16 };
15
17
16− buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv ];
18+ buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv cstruct-unix ];
17 propagatedBuildInputs = [ asn1-combinators nocrypto ];
19 propagatedBuildInputs = [ asn1-combinators nocrypto ];
18
20
19 configureFlags = "--enable-tests";
21 configureFlags = "--enable-tests";
pkgs/top-level/ocaml-packages.nix+11−4
@@ -176,10 +176,17 @@ let
176
176
177 cryptokit = callPackage ../development/ocaml-modules/cryptokit { };
177 cryptokit = callPackage ../development/ocaml-modules/cryptokit { };
178
178
179+ cstruct =
180+ if lib.versionAtLeast ocaml.version "4.2"
181+ then callPackage ../development/ocaml-modules/cstruct {}
182+ else callPackage ../development/ocaml-modules/cstruct/1.9.0.nix { lwt = ocaml_lwt; };
183+
179− cstruct = callPackage ../development/ocaml-modules/cstruct {
184+ cstruct-lwt = callPackage ../development/ocaml-modules/cstruct/lwt.nix {
180 lwt = ocaml_lwt;
185 lwt = ocaml_lwt;
181 };
186 };
182
187
188+ cstruct-unix = callPackage ../development/ocaml-modules/cstruct/unix.nix {};
189+
183 csv =
190 csv =
184 if lib.versionAtLeast ocaml.version "4.2"
191 if lib.versionAtLeast ocaml.version "4.2"
185 then callPackage ../development/ocaml-modules/csv { }
192 then callPackage ../development/ocaml-modules/csv { }
@@ -380,9 +387,7 @@ let
380
387
381 mtime = callPackage ../development/ocaml-modules/mtime { };
388 mtime = callPackage ../development/ocaml-modules/mtime { };
382
389
383− nocrypto = callPackage ../development/ocaml-modules/nocrypto {
390+ nocrypto = callPackage ../development/ocaml-modules/nocrypto { };
384− lwt = ocaml_lwt;
385− };
386
391
387 notty = callPackage ../development/ocaml-modules/notty {
392 notty = callPackage ../development/ocaml-modules/notty {
388 lwt = ocaml_lwt;
393 lwt = ocaml_lwt;
@@ -570,6 +575,8 @@ let
570 then callPackage ../development/ocaml-modules/ppx_blob {}
575 then callPackage ../development/ocaml-modules/ppx_blob {}
571 else null;
576 else null;
572
577
578+ ppx_cstruct = callPackage ../development/ocaml-modules/cstruct/ppx.nix {};
579+
573 ppx_derivers = callPackage ../development/ocaml-modules/ppx_derivers {};
580 ppx_derivers = callPackage ../development/ocaml-modules/ppx_derivers {};
574
581
575 ppx_deriving =
582 ppx_deriving =