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 uucp,
10 uutf,
11 cmdliner,
12 version ? if lib.versionAtLeast ocaml.version "4.14" then "17.0.0" else "15.0.0",
13 cmdlinerSupport ? lib.versionAtLeast cmdliner.version "1.1",
14}:
15
16let
17 pname = "uuseg";
18 webpage = "https://erratique.ch/software/${pname}";
19in
20
21stdenv.mkDerivation rec {
22
23 name = "ocaml${ocaml.version}-${pname}-${version}";
24 inherit version;
25
26 src = fetchurl {
27 url = "${webpage}/releases/${pname}-${version}.tbz";
28 hash =
29 {
30 "17.0.0" = "sha256-Fn41ajEFbMv3LLkD+zqy76217/kWFS7q9jm9ubc6TI4=";
31 "15.0.0" = "sha256-q8x3bia1QaKpzrWFxUmLWIraKqby7TuPNGvbSjkY4eM=";
32 }
33 ."${version}";
34 };
35
36 nativeBuildInputs = [
37 ocaml
38 findlib
39 ocamlbuild
40 topkg
41 ];
42 buildInputs = [
43 topkg
44 uutf
45 ]
46 ++ lib.optional cmdlinerSupport cmdliner;
47 propagatedBuildInputs = [ uucp ];
48
49 strictDeps = true;
50
51 buildPhase = ''
52 runHook preBuild
53 ${topkg.run} build \
54 --with-uutf true \
55 --with-cmdliner ${lib.boolToString cmdlinerSupport}
56 runHook postBuild
57 '';
58
59 inherit (topkg) installPhase;
60
61 meta = {
62 description = "OCaml library for segmenting Unicode text";
63 homepage = webpage;
64 license = lib.licenses.bsd3;
65 maintainers = [ lib.maintainers.vbgl ];
66 mainProgram = "usegtrip";
67 inherit (ocaml.meta) platforms;
68 };
69}