From b1c58f7f210c3356e68ea370be766d852925d8f0 Mon Sep 17 00:00:00 2001 From: Yifei Sun Date: Thu, 2 Oct 2025 18:31:16 +0200 Subject: [PATCH] ocamlPackages.ocamlmod: 0.0.9 -> 0.1.1 Update pkgs/development/tools/ocaml/ocamlmod/default.nix Co-authored-by: Vincent Laporte --- .../tools/ocaml/ocamlmod/default.nix | 71 +++++++------------ 1 file changed, 24 insertions(+), 47 deletions(-) diff --git a/pkgs/development/tools/ocaml/ocamlmod/default.nix b/pkgs/development/tools/ocaml/ocamlmod/default.nix index 3a907026526e..3f3f6bbe7f8b 100644 --- a/pkgs/development/tools/ocaml/ocamlmod/default.nix +++ b/pkgs/development/tools/ocaml/ocamlmod/default.nix @@ -1,56 +1,33 @@ { lib, - stdenv, - fetchurl, ocaml, - findlib, - ocamlbuild, - ounit, + buildDunePackage, + fetchurl, + ounit2, }: -let - # ounit is only available for OCaml >= 4.08 +buildDunePackage (finalAttrs: { + pname = "ocamlmod"; + version = "0.1.1"; + + minimalOCamlVersion = "4.03"; + + src = fetchurl { + url = "https://github.com/gildor478/ocamlmod/releases/download/v${finalAttrs.version}/ocamlmod-${finalAttrs.version}.tbz"; + hash = "sha256-qMG+y/iS+L4qtKiJX01pTTAdQuGLoIA+so1fqY9bm8o="; + }; + doCheck = lib.versionAtLeast ocaml.version "4.08"; -in + checkInputs = [ ounit2 ]; -lib.throwIf (lib.versionAtLeast ocaml.version "5.0") "ocamlmod is not available for OCaml ≥ 5.0" + dontStrip = true; - stdenv.mkDerivation - { - pname = "ocamlmod"; - version = "0.0.9"; - - src = fetchurl { - url = "https://forge.ocamlcore.org/frs/download.php/1702/ocamlmod-0.0.9.tar.gz"; - sha256 = "0cgp9qqrq7ayyhddrmqmq1affvfqcn722qiakjq4dkywvp67h4aa"; - }; - - strictDeps = !doCheck; - - nativeBuildInputs = [ - ocaml - findlib - ocamlbuild + meta = { + homepage = "https://github.com/gildor478/ocamlmod"; + description = "Generate OCaml modules from source files"; + maintainers = with lib.maintainers; [ + maggesi ]; - - configurePhase = - "ocaml setup.ml -configure --prefix $out" + lib.optionalString doCheck " --enable-tests"; - buildPhase = "ocaml setup.ml -build"; - installPhase = "ocaml setup.ml -install"; - - inherit doCheck; - nativeCheckInputs = [ ounit ]; - - checkPhase = "ocaml setup.ml -test"; - - dontStrip = true; - - meta = { - homepage = "https://forge.ocamlcore.org/projects/ocamlmod/ocamlmod"; - description = "Generate OCaml modules from source files"; - platforms = ocaml.meta.platforms or [ ]; - maintainers = with lib.maintainers; [ - maggesi - ]; - }; - } + mainProgram = "ocamlmod"; + }; +})