Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 85 lines 1.9 kB view raw
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 25 26if versionOlder ocaml.version "4.14" then 27 throw "vg is not available for OCaml ${ocaml.version}" 28else 29 30 stdenv.mkDerivation { 31 32 name = "ocaml${ocaml.version}-${pname}-${version}"; 33 34 src = fetchurl { 35 url = "${webpage}/releases/${pname}-${version}.tbz"; 36 hash = "sha256-qcTtvIfSUwzpUZDspL+54UTNvWY6u3BTvfGWF6c0Jvw="; 37 }; 38 39 nativeBuildInputs = [ 40 ocaml 41 findlib 42 ocamlbuild 43 ]; 44 buildInputs = [ topkg ]; 45 46 propagatedBuildInputs = [ 47 uchar 48 result 49 gg 50 ] 51 ++ optionals pdfBackend [ 52 otfm 53 ] 54 ++ optionals htmlcBackend [ 55 brr 56 ]; 57 58 strictDeps = true; 59 60 buildPhase = 61 topkg.buildPhase 62 + " --with-otfm ${lib.boolToString pdfBackend}" 63 + " --with-brr ${lib.boolToString htmlcBackend}" 64 + " --with-cairo2 false"; 65 66 inherit (topkg) installPhase; 67 68 meta = with lib; { 69 description = "Declarative 2D vector graphics for OCaml"; 70 longDescription = '' 71 Vg is an OCaml module for declarative 2D vector graphics. In Vg, images 72 are values that denote functions mapping points of the cartesian plane 73 to colors. The module provides combinators to define and compose these 74 values. 75 76 Renderers for PDF, SVG and the HTML canvas are distributed with the 77 module. An API allows to implement new renderers. 78 ''; 79 homepage = webpage; 80 license = licenses.isc; 81 maintainers = [ maintainers.jirkamarsik ]; 82 mainProgram = "vecho"; 83 inherit (ocaml.meta) platforms; 84 }; 85 }