summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/inotify/default.nix
blob: d1c6dc37616477a4798467bef50ecb5d30937258 (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
47
48
{ stdenv, lib, fetchFromGitHub, fetchpatch, ocaml, findlib, ocamlbuild
, ocaml_lwt # optional lwt support
, ounit, fileutils # only for tests
}:

stdenv.mkDerivation rec {
  version = "2.3";
  pname = "ocaml${ocaml.version}-inotify";

  src = fetchFromGitHub {
    owner = "whitequark";
    repo = "ocaml-inotify";
    rev = "v${version}";
    sha256 = "1s6vmqpx19hxzsi30jvp3h7p56rqnxfhfddpcls4nz8sqca1cz5y";
  };

  patches = [ (fetchpatch {
    url = "https://github.com/whitequark/ocaml-inotify/commit/716c8002cc1652f58eb0c400ae92e04003cba8c9.patch";
    sha256 = "04lfxrrsmk2mc704kaln8jqx93jc4bkxhijmfy2d4cmk1cim7r6k";
  }) ];

  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
  buildInputs = [ ocaml_lwt ];
  checkInputs = [ ounit fileutils ];

  # Otherwise checkInputs can't be found
  strictDeps = false;

  configureFlags = [ "--enable-lwt"
    (lib.optionalString doCheck "--enable-tests") ];

  postConfigure = lib.optionalString doCheck ''
    echo '<lib_test/test_inotify_lwt.*>: pkg_threads' | tee -a _tags
  '';

  doCheck = true;
  checkTarget = "test";

  createFindlibDestdir = true;

  meta = {
    description = "Bindings for Linux’s filesystem monitoring interface, inotify";
    license = lib.licenses.lgpl21;
    maintainers = [ lib.maintainers.vbgl ];
    inherit (src.meta) homepage;
    platforms = lib.platforms.linux;
  };
}