2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, ctypes, libsodium }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
if lib.versionAtLeast ocaml.version "4.10"
|
2020-05-29 06:06:01 +00:00
|
|
|
then throw "sodium is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ocaml${ocaml.version}-sodium";
|
|
|
|
version = "0.6.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dsheets";
|
|
|
|
repo = "ocaml-sodium";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "124gpi1jhac46x05gp5viykyrafnlp03v1cmkl13c6pgcs8w04pv";
|
|
|
|
};
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
patches = [
|
|
|
|
# ctypes.stubs no longer pulls in bigarray automatically
|
|
|
|
./lib-gen-link-bigarray.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild ];
|
|
|
|
propagatedBuildInputs = [ ctypes libsodium ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
hardeningDisable = lib.optional stdenv.isDarwin "strictoverflow";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/dsheets/ocaml-sodium";
|
|
|
|
description = "Binding to libsodium 1.0.9+";
|
|
|
|
platforms = ocaml.meta.platforms or [];
|
|
|
|
maintainers = [ maintainers.rixed ];
|
|
|
|
};
|
|
|
|
}
|