nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildDunePackage
3, fetchFromGitHub
4, fetchpatch
5, ocaml
6
7, alcotest
8, cstruct
9, mirage-crypto
10}:
11
12buildDunePackage rec {
13 pname = "chacha";
14 version = "1.1.0";
15
16 src = fetchFromGitHub {
17 owner = "abeaumont";
18 repo = "ocaml-chacha";
19 rev = version;
20 hash = "sha256-PmeiFloU0k3SqOK1VjaliiCEzDzrzyMSasgnO5fJS1k=";
21 };
22
23 # Ensure compatibility with cstruct ≥ 6.1.0
24 patches = [ (fetchpatch {
25 url = "https://github.com/abeaumont/ocaml-chacha/commit/fbe4a0a808226229728a68f278adf370251196fd.patch";
26 sha256 = "sha256-y7X9toFDrgdv3qmFmUs7K7QS+Gy45rRLulKy48m7uqc=";
27 })];
28
29 minimalOCamlVersion = "4.02";
30 duneVersion = "3";
31
32 propagatedBuildInputs = [ cstruct mirage-crypto ];
33
34 # alcotest isn't available for OCaml < 4.05 due to fmt
35 doCheck = lib.versionAtLeast ocaml.version "4.05";
36 checkInputs = [ alcotest ];
37
38 meta = {
39 homepage = "https://github.com/abeaumont/ocaml-chacha";
40 description = "ChaCha20, ChaCha12 and ChaCha8 encryption functions, in OCaml";
41 longDescription = ''
42 An OCaml implementation of ChaCha functions, both ChaCha20 and the reduced
43 ChaCha8 and ChaCha12 functions. The hot loop is implemented in C for efficiency
44 reasons.
45 '';
46 license = lib.licenses.bsd2;
47 maintainers = with lib.maintainers; [ fufexan ];
48 };
49}