nixpkgs/pkgs/development/ocaml-modules/vg/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

92 lines
2.0 KiB
Nix

{
stdenv,
lib,
fetchurl,
ocaml,
findlib,
ocamlbuild,
topkg,
uchar,
result,
gg,
uutf,
otfm,
js_of_ocaml,
js_of_ocaml-ppx,
pdfBackend ? true, # depends on uutf and otfm
htmlcBackend ? true, # depends on js_of_ocaml
}:
let
inherit (lib) optionals versionOlder;
pname = "vg";
version = "0.9.4";
webpage = "https://erratique.ch/software/${pname}";
in
if versionOlder ocaml.version "4.03" then
throw "vg is not available for OCaml ${ocaml.version}"
else
stdenv.mkDerivation {
name = "ocaml${ocaml.version}-${pname}-${version}";
src = fetchurl {
url = "${webpage}/releases/${pname}-${version}.tbz";
sha256 = "181sz6l5xrj5jvwg4m2yqsjzwp2s5h8v0mwhjcwbam90kdfx2nak";
};
nativeBuildInputs = [
ocaml
findlib
ocamlbuild
];
buildInputs = [ topkg ];
propagatedBuildInputs =
[
uchar
result
gg
]
++ optionals pdfBackend [
uutf
otfm
]
++ optionals htmlcBackend [
js_of_ocaml
js_of_ocaml-ppx
];
strictDeps = true;
buildPhase =
topkg.buildPhase
+ " --with-uutf ${lib.boolToString pdfBackend}"
+ " --with-otfm ${lib.boolToString pdfBackend}"
+ " --with-js_of_ocaml ${lib.boolToString htmlcBackend}"
+ " --with-cairo2 false";
inherit (topkg) installPhase;
meta = with lib; {
description = "Declarative 2D vector graphics for OCaml";
longDescription = ''
Vg is an OCaml module for declarative 2D vector graphics. In Vg, images
are values that denote functions mapping points of the cartesian plane
to colors. The module provides combinators to define and compose these
values.
Renderers for PDF, SVG and the HTML canvas are distributed with the
module. An API allows to implement new renderers.
'';
homepage = webpage;
license = licenses.isc;
maintainers = [ maintainers.jirkamarsik ];
mainProgram = "vecho";
inherit (ocaml.meta) platforms;
};
}