From 97d45f98f22f39d6af400a45028221feda64c56e Mon Sep 17 00:00:00 2001 From: Volker Diels-Grabsch Date: Thu, 28 Nov 2024 19:42:01 +0100 Subject: [PATCH] ocamlPackages.melange: init at 4.0.1-52 + 4.0.0-51 + 4.0.0-414 --- .../tools/ocaml/melange/default.nix | 83 +++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 + 2 files changed, 85 insertions(+) create mode 100644 pkgs/development/tools/ocaml/melange/default.nix diff --git a/pkgs/development/tools/ocaml/melange/default.nix b/pkgs/development/tools/ocaml/melange/default.nix new file mode 100644 index 000000000000..c81ca2a6cf56 --- /dev/null +++ b/pkgs/development/tools/ocaml/melange/default.nix @@ -0,0 +1,83 @@ +{ + buildDunePackage, + cmdliner, + cppo, + dune-build-info, + fetchurl, + jq, + lib, + makeWrapper, + menhirLib, + merlin, + nodejs, + ocaml, + ounit2, + ppxlib, + reason, + stdenv, + tree, +}: + +let + pname = "melange"; + versionHash = + if lib.versionAtLeast ocaml.version "5.2" then + { + version = "4.0.1-52"; + hash = "sha256-kUlChqQtLX7zh90GK23ibMqyI/MIp0sMYLjkPX9vdTc="; + } + else if lib.versionAtLeast ocaml.version "5.1" then + { + version = "4.0.0-51"; + hash = "sha256-940Yzp1ZXnN6mKVWY+nqKjn4qtBUJR5eHE55OTjGvdU="; + } + else + { + version = "4.0.0-414"; + hash = "sha256-PILDOXYIyLvfv1sSwP6WSdCiXfpYdnct7WMw3jHBLJM="; + }; + version = versionHash.version; + hash = versionHash.hash; +in +buildDunePackage { + inherit pname; + inherit version; + minimalOCamlVersion = "4.14"; + src = fetchurl { + url = "https://github.com/melange-re/${pname}/releases/download/${version}/${pname}-${version}.tbz"; + inherit hash; + }; + nativeBuildInputs = [ + cppo + makeWrapper + ]; + propagatedBuildInputs = [ + cmdliner + dune-build-info + menhirLib + ppxlib + ]; + doCheck = true; + nativeCheckInputs = [ + jq + merlin + nodejs + reason + tree + ]; + checkInputs = [ + ounit2 + ]; + postInstall = '' + wrapProgram "$out/bin/melc" --set MELANGELIB "$OCAMLFIND_DESTDIR/melange/melange:$OCAMLFIND_DESTDIR/melange/js/melange" + ''; + meta = { + description = "Toolchain to produce JS from Reason/OCaml"; + homepage = "https://melange.re/"; + mainProgram = "melc"; + license = lib.licenses.lgpl3; + maintainers = [ + lib.maintainers.vog + ]; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 6f244496f514..35cb14aff535 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1070,6 +1070,8 @@ let mec = callPackage ../development/ocaml-modules/mec { }; + melange = callPackage ../development/tools/ocaml/melange { }; + memprof-limits = callPackage ../development/ocaml-modules/memprof-limits { }; memtrace = callPackage ../development/ocaml-modules/memtrace { };