diff --git a/pkgs/development/ocaml-modules/uutf/default.nix b/pkgs/development/ocaml-modules/uutf/default.nix index 0908650560b8..f1fbaa1ab569 100644 --- a/pkgs/development/ocaml-modules/uutf/default.nix +++ b/pkgs/development/ocaml-modules/uutf/default.nix @@ -8,46 +8,52 @@ cmdliner, topkg, uchar, + version ? + if lib.versionAtLeast ocaml.version "4.08" then + "1.0.4" + else if lib.versionAtLeast ocaml.version "4.03" then + "1.0.3" + else + throw "uutf is not available with OCaml ${ocaml.version}", }: -let - pname = "uutf"; -in -lib.throwIfNot (lib.versionAtLeast ocaml.version "4.03") - "${pname} is not available with OCaml ${ocaml.version}" +stdenv.mkDerivation { + name = "ocaml${ocaml.version}-uutf-${version}"; + inherit version; - stdenv.mkDerivation - rec { - name = "ocaml${ocaml.version}-${pname}-${version}"; - version = "1.0.3"; + src = fetchurl { + url = "https://erratique.ch/software/uutf/releases/uutf-${version}.tbz"; + hash = + { + "1.0.3" = "sha256-h3KlYT0ecCmM4U3zMkGjaF8h5O9r20zwP+mF+x7KBWg="; + "1.0.4" = "sha256-p6V45q+RSaiJThjjtHWchWWTemnGyaznowu/BIRhnKg="; + } + ."${version}"; + }; - src = fetchurl { - url = "https://erratique.ch/software/${pname}/releases/${pname}-${version}.tbz"; - sha256 = "sha256-h3KlYT0ecCmM4U3zMkGjaF8h5O9r20zwP+mF+x7KBWg="; - }; + nativeBuildInputs = [ + ocaml + ocamlbuild + findlib + topkg + ]; + buildInputs = [ + topkg + cmdliner + ]; + propagatedBuildInputs = [ uchar ]; - nativeBuildInputs = [ - ocaml - ocamlbuild - findlib - topkg - ]; - buildInputs = [ - topkg - cmdliner - ]; - propagatedBuildInputs = [ uchar ]; + strictDeps = true; - strictDeps = true; + inherit (topkg) buildPhase installPhase; - inherit (topkg) buildPhase installPhase; - - meta = with lib; { - description = "Non-blocking streaming Unicode codec for OCaml"; - homepage = "https://erratique.ch/software/uutf"; - license = licenses.bsd3; - maintainers = [ maintainers.vbgl ]; - mainProgram = "utftrip"; - inherit (ocaml.meta) platforms; - }; - } + meta = with lib; { + description = "Non-blocking streaming Unicode codec for OCaml"; + homepage = "https://erratique.ch/software/uutf"; + changelog = "https://raw.githubusercontent.com/dbuenzli/uutf/refs/tags/v${version}/CHANGES.md"; + license = licenses.isc; + maintainers = [ maintainers.vbgl ]; + mainProgram = "utftrip"; + inherit (ocaml.meta) platforms; + }; +}