nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, re, stringext, ounit
2, sexplib, ppx_sexp_conv
3, legacyVersion ? false
4, sexplib_p4
5}:
6
7if !stdenv.lib.versionAtLeast ocaml.version "4"
8|| legacyVersion && stdenv.lib.versionAtLeast ocaml.version "4.03"
9then throw "uri${stdenv.lib.optionalString legacyVersion "_p4"} is not available for OCaml ${ocaml.version}" else
10
11with
12 if legacyVersion
13 then {
14 version = "1.9.1";
15 sha256 = "0v3jxqgyi4kj92r3x83rszfpnvvzy9lyb913basch4q64yka3w85";
16 } else {
17 version = "1.9.2";
18 sha256 = "137pg8j654x7r0d1664iy2zp3l82nki1kkh921lwdrwc5qqdl6jx";
19 };
20
21stdenv.mkDerivation {
22 name = "ocaml${ocaml.version}-uri-${version}";
23
24 src = fetchzip {
25 url = "https://github.com/mirage/ocaml-uri/archive/v${version}.tar.gz";
26 inherit sha256;
27 };
28
29 buildInputs = [ ocaml findlib ocamlbuild ounit ]
30 ++ stdenv.lib.optional (!legacyVersion) ppx_sexp_conv;
31 propagatedBuildInputs = [ re (if legacyVersion then sexplib_p4 else sexplib) stringext ];
32
33 configurePhase = "ocaml setup.ml -configure --prefix $out --enable-tests";
34 buildPhase = ''
35 ocaml setup.ml -build
36 ocaml setup.ml -doc
37 '';
38 doCheck = true;
39 checkPhase = "ocaml setup.ml -test";
40 installPhase = "ocaml setup.ml -install";
41
42 createFindlibDestdir = true;
43
44 meta = {
45 homepage = https://github.com/mirage/ocaml-uri;
46 platforms = ocaml.meta.platforms or [];
47 description = "RFC3986 URI parsing library for OCaml";
48 license = stdenv.lib.licenses.isc;
49 maintainers = with stdenv.lib.maintainers; [ vbgl ];
50 };
51}