nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 ocaml,
6 findlib,
7 ocamlbuild,
8 topkg,
9 uchar,
10 result,
11 gg,
12 otfm,
13 brr,
14 pdfBackend ? true, # depends on otfm
15 htmlcBackend ? true, # depends on brr
16}:
17
18let
19 inherit (lib) optionals versionOlder;
20
21 pname = "vg";
22 version = "0.9.5";
23 webpage = "https://erratique.ch/software/${pname}";
24in
25stdenv.mkDerivation {
26
27 name = "ocaml${ocaml.version}-${pname}-${version}";
28
29 src = fetchurl {
30 url = "${webpage}/releases/${pname}-${version}.tbz";
31 hash = "sha256-qcTtvIfSUwzpUZDspL+54UTNvWY6u3BTvfGWF6c0Jvw=";
32 };
33
34 nativeBuildInputs = [
35 ocaml
36 findlib
37 ocamlbuild
38 ];
39 buildInputs = [ topkg ];
40
41 propagatedBuildInputs = [
42 uchar
43 result
44 gg
45 ]
46 ++ optionals pdfBackend [
47 otfm
48 ]
49 ++ optionals htmlcBackend [
50 brr
51 ];
52
53 strictDeps = true;
54
55 buildPhase =
56 topkg.buildPhase
57 + " --with-otfm ${lib.boolToString pdfBackend}"
58 + " --with-brr ${lib.boolToString htmlcBackend}"
59 + " --with-cairo2 false";
60
61 inherit (topkg) installPhase;
62
63 meta = {
64 description = "Declarative 2D vector graphics for OCaml";
65 longDescription = ''
66 Vg is an OCaml module for declarative 2D vector graphics. In Vg, images
67 are values that denote functions mapping points of the cartesian plane
68 to colors. The module provides combinators to define and compose these
69 values.
70
71 Renderers for PDF, SVG and the HTML canvas are distributed with the
72 module. An API allows to implement new renderers.
73 '';
74 homepage = webpage;
75 license = lib.licenses.isc;
76 maintainers = [ lib.maintainers.jirkamarsik ];
77 mainProgram = "vecho";
78 inherit (ocaml.meta) platforms;
79 broken = versionOlder ocaml.version "4.14";
80 };
81}