1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ocaml,
6 findlib,
7 ocamlbuild,
8 ctypes,
9 libsodium,
10}:
11
12lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
13 "sodium is not available for OCaml ${ocaml.version}"
14
15 stdenv.mkDerivation
16 rec {
17 pname = "ocaml${ocaml.version}-sodium";
18 version = "0.6.0";
19
20 src = fetchFromGitHub {
21 owner = "dsheets";
22 repo = "ocaml-sodium";
23 rev = version;
24 sha256 = "124gpi1jhac46x05gp5viykyrafnlp03v1cmkl13c6pgcs8w04pv";
25 };
26
27 patches = [
28 # ctypes.stubs no longer pulls in bigarray automatically
29 ./lib-gen-link-bigarray.patch
30 ];
31
32 nativeBuildInputs = [
33 ocaml
34 findlib
35 ocamlbuild
36 ];
37 propagatedBuildInputs = [
38 ctypes
39 libsodium
40 ];
41
42 strictDeps = true;
43
44 createFindlibDestdir = true;
45
46 hardeningDisable = lib.optional stdenv.hostPlatform.isDarwin "strictoverflow";
47
48 meta = with lib; {
49 homepage = "https://github.com/dsheets/ocaml-sodium";
50 description = "Binding to libsodium 1.0.9+";
51 inherit (ocaml.meta) platforms;
52 maintainers = [ maintainers.rixed ];
53 };
54 }