1{
2 lib,
3 which,
4 stdenv,
5 fetchzip,
6 cmake,
7 ocaml,
8 findlib,
9 ctypes,
10 cppo,
11}:
12stdenv.mkDerivation rec {
13 pname = "ocaml${ocaml.version}-hacl-star-raw";
14 version = "0.7.2";
15
16 src = fetchzip {
17 url = "https://github.com/cryspen/hacl-packages/releases/download/ocaml-v${version}/hacl-star.${version}.tar.gz";
18 hash = "sha256-6WPbdkT9IsX0Q8mF2vLBJMktEES8tU45JztOPepAL0o=";
19 stripRoot = false;
20 };
21
22 # strictoverflow is disabled because it breaks aarch64-darwin
23 hardeningDisable = [ "strictoverflow" ];
24
25 postPatch = ''
26 patchShebangs ./
27 '';
28
29 buildPhase = ''
30 runHook preBuild
31
32 make -C hacl-star-raw build-c
33 make -C hacl-star-raw build-bindings
34
35 runHook postBuild
36 '';
37
38 preInstall = ''
39 mkdir $out
40 mkdir -p $OCAMLFIND_DESTDIR/stublibs
41 '';
42
43 installPhase = ''
44 runHook preInstall
45
46 make -C hacl-star-raw install
47
48 runHook postInstall
49 '';
50
51 dontUseCmakeConfigure = true;
52 dontAddPrefix = true;
53 dontAddStaticConfigureFlags = true;
54 createFindlibDestdir = true;
55
56 nativeBuildInputs = [
57 which
58 cmake
59 ocaml
60 findlib
61 ];
62
63 propagatedBuildInputs = [
64 ctypes
65 ];
66
67 checkInputs = [
68 cppo
69 ];
70
71 strictDeps = true;
72
73 doCheck = true;
74
75 meta = {
76 inherit (ocaml.meta) platforms;
77 description = "Auto-generated low-level OCaml bindings for EverCrypt/HACL*";
78 license = lib.licenses.asl20;
79 maintainers = [ lib.maintainers.ulrikstrid ];
80 };
81}