nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 ocaml,
6 findlib,
7 ocamlbuild,
8 topkg,
9 uutf,
10 cmdliner,
11 cmdlinerSupport ? lib.versionAtLeast cmdliner.version "1.1",
12 version ? if lib.versionAtLeast ocaml.version "4.14" then "17.0.0" else "15.0.0",
13}:
14
15let
16 pname = "uunf";
17 webpage = "https://erratique.ch/software/${pname}";
18 hash =
19 {
20 "15.0.0" = "sha256-B/prPAwfqS8ZPS3fyDDIzXWRbKofwOCyCfwvh9veuug=";
21 "17.0.0" = "sha256-5XYZU8Ros2aiCy04xzLiwhN+v5kM9Y3twdVPQ8IY1GA=";
22 }
23 ."${version}";
24in
25stdenv.mkDerivation {
26 name = "ocaml${ocaml.version}-${pname}-${version}";
27 inherit version;
28
29 src = fetchurl {
30 url = "${webpage}/releases/${pname}-${version}.tbz";
31 inherit hash;
32 };
33
34 nativeBuildInputs = [
35 ocaml
36 findlib
37 ocamlbuild
38 topkg
39 ];
40 buildInputs = [
41 topkg
42 uutf
43 ]
44 ++ lib.optional cmdlinerSupport cmdliner;
45
46 strictDeps = true;
47
48 prePatch = lib.optionalString stdenv.hostPlatform.isAarch64 "ulimit -s 16384";
49
50 buildPhase = ''
51 runHook preBuild
52 ${topkg.run} build \
53 --with-uutf true \
54 --with-cmdliner ${lib.boolToString cmdlinerSupport}
55 runHook postBuild
56 '';
57
58 inherit (topkg) installPhase;
59
60 meta = {
61 description = "OCaml module for normalizing Unicode text";
62 homepage = webpage;
63 license = lib.licenses.bsd3;
64 maintainers = [ lib.maintainers.vbgl ];
65 mainProgram = "unftrip";
66 inherit (ocaml.meta) platforms;
67 broken = lib.versionOlder ocaml.version "4.03";
68 };
69}