summaryrefslogtreecommitdiffstats
path: root/pkgs/development/ocaml-modules/cryptokit/default.nix
blob: 8d33c7e475349bd7a3f161b184bdaa2253940d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  lib,
  buildDunePackage,
  ocaml,
  fetchFromGitHub,
  zlib,
  dune-configurator,
  zarith,
  version ? if lib.versionAtLeast ocaml.version "4.13" then "1.21.1" else "1.20.1",
}:

buildDunePackage (finalAttrs: {
  pname = "cryptokit";
  inherit version;

  src = fetchFromGitHub {
    owner = "xavierleroy";
    repo = "cryptokit";
    tag = "release${lib.replaceStrings [ "." ] [ "" ] finalAttrs.version}";
    hash =
      {
        "1.21.1" = "sha256-9JU9grZpTTrYYO9gai2UPq119HfenI1JAY+EyoR6x7Q=";
        "1.20.1" = "sha256-VFY10jGctQfIUVv7dK06KP8zLZHLXTxvLyTCObS+W+E=";
      }
      ."${finalAttrs.version}";
  };

  # dont do autotools configuration, but do trigger findlib's preConfigure hook
  configurePhase = ''
    runHook preConfigure
    runHook postConfigure
  '';

  buildInputs = [ dune-configurator ];
  propagatedBuildInputs = [
    zarith
    zlib
  ];

  doCheck = true;

  meta = {
    homepage = "http://pauillac.inria.fr/~xleroy/software.html";
    description = "Library of cryptographic primitives for OCaml";
    license = lib.licenses.lgpl2Only;
  };
})