diff --git a/pkgs/development/ocaml-modules/mirage-crypto/default.nix b/pkgs/development/ocaml-modules/mirage-crypto/default.nix index ab48e01950e..1ecd71fe77f 100644 --- a/pkgs/development/ocaml-modules/mirage-crypto/default.nix +++ b/pkgs/development/ocaml-modules/mirage-crypto/default.nix @@ -1,14 +1,17 @@ -{ lib, fetchurl, buildDunePackage, ounit, cstruct, dune-configurator, eqaf, pkg-config }: +{ lib, fetchurl, buildDunePackage, ounit, cstruct, dune-configurator, eqaf, pkg-config +, withFreestanding ? false +, ocaml-freestanding +}: buildDunePackage rec { minimumOCamlVersion = "4.08"; pname = "mirage-crypto"; - version = "0.8.10"; + version = "0.9.0"; src = fetchurl { url = "https://github.com/mirage/mirage-crypto/releases/download/v${version}/mirage-crypto-v${version}.tbz"; - sha256 = "8a5976fe7837491d2fbd1917b77524776f70ae590e9f55cf757cc8951b5481fc"; + sha256 = "716684f8a70031f16115e3c84d42141c75fb1e688b7a699bbd09166176ed5217"; }; useDune2 = true; @@ -17,12 +20,20 @@ buildDunePackage rec { checkInputs = [ ounit ]; nativeBuildInputs = [ dune-configurator pkg-config ]; - propagatedBuildInputs = [ cstruct eqaf ]; + propagatedBuildInputs = [ + cstruct eqaf + ] ++ lib.optionals withFreestanding [ + ocaml-freestanding + ]; meta = with lib; { homepage = "https://github.com/mirage/mirage-crypto"; description = "Simple symmetric cryptography for the modern age"; - license = licenses.isc; + license = [ + licenses.isc # default license + licenses.bsd2 # mirage-crypto-rng-mirage + licenses.mit # mirage-crypto-ec + ]; maintainers = with maintainers; [ sternenseemann ]; }; } diff --git a/pkgs/development/ocaml-modules/mirage-crypto/ec.nix b/pkgs/development/ocaml-modules/mirage-crypto/ec.nix new file mode 100644 index 00000000000..bcd7a1f04f2 --- /dev/null +++ b/pkgs/development/ocaml-modules/mirage-crypto/ec.nix @@ -0,0 +1,55 @@ +{ lib +, buildDunePackage +, mirage-crypto +, dune-configurator +, pkg-config +, cstruct +, mirage-crypto-rng +, mirage-crypto-pk +, hex +, alcotest +, asn1-combinators +, ppx_deriving_yojson +, ppx_deriving +, yojson +, withFreestanding ? false +, ocaml-freestanding +}: + +buildDunePackage { + pname = "mirage-crypto-ec"; + + inherit (mirage-crypto) + minimumOCamlVersion + src + version + useDune2 + ; + + nativeBuildInputs = [ + pkg-config + dune-configurator + ]; + propagatedBuildInputs = [ + cstruct + mirage-crypto + mirage-crypto-rng + ] ++ lib.optionals withFreestanding [ + ocaml-freestanding + ]; + + doCheck = true; + checkInputs = [ + hex + alcotest + asn1-combinators + ppx_deriving_yojson + ppx_deriving + yojson + mirage-crypto-pk + ]; + + meta = mirage-crypto.meta // { + description = "Elliptic Curve Cryptography with primitives taken from Fiat"; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index ee11ffdac21..826f7cf8e45 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -691,6 +691,8 @@ let mirage-crypto = callPackage ../development/ocaml-modules/mirage-crypto { }; + mirage-crypto-ec = callPackage ../development/ocaml-modules/mirage-crypto/ec.nix { }; + mirage-crypto-pk = callPackage ../development/ocaml-modules/mirage-crypto/pk.nix { }; mirage-crypto-rng = callPackage ../development/ocaml-modules/mirage-crypto/rng.nix { };