summaryrefslogtreecommitdiff
path: root/pkgs/development/ocaml-modules/cmdliner/default.nix
blob: 3c8900103c7c546803188737db0e25fddb15f699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  lib,
  stdenv,
  fetchurl,
  ocaml,
  version ? "2.1.1",
}:

stdenv.mkDerivation {
  pname = "cmdliner";
  inherit version;

  src = fetchurl {
    url = "https://erratique.ch/software/cmdliner/releases/cmdliner-${version}.tbz";
    hash =
      {
        "1.0.4" = "sha256-XCqT1Er4o4mWosD4D715cP5HUfEEvkcMr6BpNT/ABMA=";
        "1.3.0" = "sha256-joGA9XO0QPanqMII2rLK5KgjhP7HMtInhNG7bmQWjLs=";
        "2.1.1" = "sha256-Bbk40d709UxHgXjxmCgig0UQQx7ZjyrGfLTZCqEg1rY=";
      }
      ."${version}";
  };

  nativeBuildInputs = [ ocaml ];

  makeFlags = [ "PREFIX=$(out)" ];
  installTargets = "install install-doc";
  installFlags = [
    "LIBDIR=$(out)/lib/ocaml/${ocaml.version}/site-lib/cmdliner"
    "DOCDIR=$(out)/share/doc/cmdliner"
  ];
  postInstall = ''
    mv $out/lib/ocaml/${ocaml.version}/site-lib/cmdliner/{opam,cmdliner.opam}
  '';

  meta = {
    homepage = "https://erratique.ch/software/cmdliner";
    description = "OCaml module for the declarative definition of command line interfaces";
    license = lib.licenses.isc;
    inherit (ocaml.meta) platforms;
    maintainers = [ lib.maintainers.vbgl ];
  };
}