summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/topkg/default.nix
blob: 1b1a127c5361fff1492717ddf59e757a79a74103 (plain) (blame)
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
{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opam }:

let ocaml-version = stdenv.lib.getVersion ocaml; in

stdenv.mkDerivation rec {
  name = "ocaml${ocaml-version}-topkg-${version}";
  version = "0.7.8";

  src = fetchurl {
    url = "http://erratique.ch/software/topkg/releases/topkg-${version}.tbz";
    sha256 = "029lbmabczpmcgkj53mc20vmpcn3f7rf7xms4xf0nywswfzsash6";
  };

  nativeBuildInputs = [ opam ];
  buildInputs = [ ocaml findlib ocamlbuild ];
  propagatedBuildInputs = [ result ];

  unpackCmd = "tar xjf ${src}";
  buildPhase = "ocaml -I ${findlib}/lib/ocaml/${ocaml-version}/site-lib/ pkg/pkg.ml build";
  createFindlibDestdir = true;
  installPhase = ''
    opam-installer --script --prefix=$out topkg.install | sh
    mv $out/lib/topkg $out/lib/ocaml/${ocaml-version}/site-lib/
  '';

  meta = {
    homepage = http://erratique.ch/software/topkg;
    license = stdenv.lib.licenses.isc;
    maintainers = [ stdenv.lib.maintainers.vbgl ];
    description = "A packager for distributing OCaml software";
    inherit (ocaml.meta) platforms;
  };
}