From c2db123b219931b3f9ae72003196fd66944a6466 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Mon, 13 Apr 2020 13:20:48 +0200 Subject: [PATCH] mirage-crypto{,-rng,-pk}: init at 0.6.2 --- .../ocaml-modules/mirage-crypto/default.nix | 33 +++++++++++++++++++ .../ocaml-modules/mirage-crypto/pk.nix | 19 +++++++++++ .../ocaml-modules/mirage-crypto/rng.nix | 16 +++++++++ pkgs/top-level/ocaml-packages.nix | 6 ++++ 4 files changed, 74 insertions(+) create mode 100644 pkgs/development/ocaml-modules/mirage-crypto/default.nix create mode 100644 pkgs/development/ocaml-modules/mirage-crypto/pk.nix create mode 100644 pkgs/development/ocaml-modules/mirage-crypto/rng.nix diff --git a/pkgs/development/ocaml-modules/mirage-crypto/default.nix b/pkgs/development/ocaml-modules/mirage-crypto/default.nix new file mode 100644 index 00000000000..2ca41800baf --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-crypto/default.nix @@ -0,0 +1,33 @@ +{ lib, fetchurl, buildDunePackage, ounit, cstruct, ocplib-endian +, cpuid, dune-configurator, cpuAcceleration ? false }: + +buildDunePackage rec { + minimumOCamlVersion = "4.07"; + + pname = "mirage-crypto"; + version = "0.6.2"; + + src = fetchurl { + url = "https://github.com/mirage/mirage-crypto/releases/download/v${version}/mirage-crypto-v${version}.tbz"; + sha256 = "08xq49cxn66yi0gfajzi8czcxfx24rd191rvf7s10wfkz304sa72"; + }; + + useDune2 = true; + + preBuild = '' + MIRAGE_CRYPTO_ACCELERATE=${lib.boolToString cpuAcceleration} + ''; + + doCheck = true; + checkInputs = [ ounit ]; + + nativeBuildInputs = [ cpuid dune-configurator ]; + propagatedBuildInputs = [ cstruct ocplib-endian ]; + + meta = with lib; { + homepage = "https://github.com/mirage/mirage-crypto"; + description = "Simple symmetric cryptography for the modern age"; + license = licenses.isc; + maintainers = with maintainers; [ sternenseemann ]; + }; +} diff --git a/pkgs/development/ocaml-modules/mirage-crypto/pk.nix b/pkgs/development/ocaml-modules/mirage-crypto/pk.nix new file mode 100644 index 00000000000..d6c4d494510 --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-crypto/pk.nix @@ -0,0 +1,19 @@ +{ buildDunePackage, ounit, randomconv, mirage-crypto, mirage-crypto-rng +, cstruct, sexplib, ppx_sexp_conv, zarith, eqaf, rresult, gmp }: + +buildDunePackage { + pname = "mirage-crypto-pk"; + + inherit (mirage-crypto) version src useDune2 minimumOCamlVersion; + + buildInputs = [ gmp ]; + propagatedBuildInputs = [ cstruct mirage-crypto mirage-crypto-rng + zarith eqaf rresult sexplib ppx_sexp_conv ]; + + doCheck = true; + checkInputs = [ ounit randomconv ]; + + meta = mirage-crypto.meta // { + description = "Simple public-key cryptography for the modern age"; + }; +} diff --git a/pkgs/development/ocaml-modules/mirage-crypto/rng.nix b/pkgs/development/ocaml-modules/mirage-crypto/rng.nix new file mode 100644 index 00000000000..b70a4d37d0d --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-crypto/rng.nix @@ -0,0 +1,16 @@ +{ buildDunePackage, mirage-crypto, ounit, randomconv, cstruct }: + +buildDunePackage { + pname = "mirage-crypto-rng"; + + inherit (mirage-crypto) version src nativeBuildInputs useDune2 minimumOCamlVersion; + + doCheck = true; + checkInputs = [ ounit randomconv ]; + + propagatedBuildInputs = [ cstruct mirage-crypto ]; + + meta = mirage-crypto.meta // { + description = "A cryptographically secure PRNG"; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index bef843ed32a..4c2c6f23d1e 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -538,6 +538,12 @@ let mirage-clock = callPackage ../development/ocaml-modules/mirage-clock { }; + mirage-crypto = callPackage ../development/ocaml-modules/mirage-crypto { }; + + mirage-crypto-pk = callPackage ../development/ocaml-modules/mirage-crypto/pk.nix { }; + + mirage-crypto-rng = callPackage ../development/ocaml-modules/mirage-crypto/rng.nix { }; + mirage-device = callPackage ../development/ocaml-modules/mirage-device { }; mirage-flow = callPackage ../development/ocaml-modules/mirage-flow { };