Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, ocaml, findlib, camlpdf, ncurses }:
2
3if lib.versionOlder ocaml.version "4.10"
4then throw "cpdf is not available for OCaml ${ocaml.version}"
5else
6
7stdenv.mkDerivation rec {
8 pname = "ocaml${ocaml.version}-cpdf";
9 version = "2.5";
10
11 src = fetchFromGitHub {
12 owner = "johnwhitington";
13 repo = "cpdf-source";
14 rev = "v${version}";
15 sha256 = "sha256:1qmx229nij7g6qmiacmyy4mcgx3k9509p4slahivshqm79d6wiwl";
16 };
17
18 nativeBuildInputs = [ ocaml findlib ];
19 buildInputs = [ ncurses ];
20 propagatedBuildInputs = [ camlpdf ];
21
22 strictDeps = true;
23
24 preInstall = ''
25 mkdir -p $OCAMLFIND_DESTDIR
26 mkdir -p $out/bin
27 cp cpdf $out/bin
28 mkdir -p $out/share/
29 cp -r doc $out/share
30 cp cpdfmanual.pdf $out/share/doc/cpdf/
31 '';
32
33 meta = with lib; {
34 description = "PDF Command Line Tools";
35 homepage = "https://www.coherentpdf.com/";
36 license = licenses.unfree;
37 maintainers = [ maintainers.vbgl ];
38 mainProgram = "cpdf";
39 inherit (ocaml.meta) platforms;
40 };
41}