summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/ocaml-r/default.nix
blob: fcee63de3b5db9c165a21f3d6ce016dbb48994a9 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, fetchFromGitHub, buildDunePackage, pkg-config, dune-configurator, stdio, R
, alcotest
}:

buildDunePackage rec {
  pname = "ocaml-r";
  version = "0.4.0";

  useDune2 = true;

  minimumOCamlVersion = "4.08";

  src = fetchFromGitHub {
    owner = "pveber";
    repo = pname;
    rev = "v${version}";
    sha256 = "10is2s148kfh3g0pwniyzp5mh48k57ldvn8gm86469zvgxyij1ri";
  };

  # Without the following patch, stub generation fails with:
  # > Fatal error: exception (Failure "not supported: osVersion")
  preConfigure = ''
    substituteInPlace stubgen/stubgen.ml --replace  \
    'failwithf "not supported: %s" name ()' \
    'sprintf "(* not supported: %s *)" name'
    substituteInPlace lib/config/discover.ml --replace \
    ' libRmath"' '"'
  '';

  # This currently fails with dune
  strictDeps = false;

  nativeBuildInputs = [ pkg-config R ];
  buildInputs = [ dune-configurator stdio R ];

  doCheck = true;
  checkInputs = [ alcotest ];

  meta = {
    description = "OCaml bindings for the R interpreter";
    inherit (src.meta) homepage;
    license = lib.licenses.gpl3;
    maintainers = [ lib.maintainers.bcdarwin ];
  };

}