1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 lua,
7 pkg-config,
8 rsync,
9 asciidoc,
10 libxml2,
11 docbook_xml_dtd_45,
12 docbook_xsl,
13 libxslt,
14 apple-sdk,
15}:
16
17let
18 xnu = apple-sdk.sourceRelease "xnu";
19in
20stdenv.mkDerivation rec {
21 pname = "lsyncd";
22 version = "2.3.1";
23
24 src = fetchFromGitHub {
25 owner = "axkibe";
26 repo = "lsyncd";
27 rev = "release-${version}";
28 hash = "sha256-QBmvS1HGF3VWS+5aLgDr9AmUfEsuSz+DTFIeql2XHH4=";
29 };
30
31 postPatch = ''
32 substituteInPlace default-rsync.lua \
33 --replace "/usr/bin/rsync" "${rsync}/bin/rsync"
34 '';
35
36 # Special flags needed on Darwin:
37 # https://github.com/axkibe/lsyncd/blob/42413cabbedca429d55a5378f6e830f191f3cc86/INSTALL#L51
38 cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
39 "-DWITH_INOTIFY=OFF"
40 "-DWITH_FSEVENTS=ON"
41 "-DXNU_DIR=${xnu}"
42 ];
43
44 dontUseCmakeBuildDir = true;
45
46 nativeBuildInputs = [
47 cmake
48 pkg-config
49 ];
50 buildInputs = [
51 rsync
52 lua
53 asciidoc
54 libxml2
55 docbook_xml_dtd_45
56 docbook_xsl
57 libxslt
58 ];
59
60 meta = with lib; {
61 homepage = "https://github.com/axkibe/lsyncd";
62 description = "Utility that synchronizes local directories with remote targets";
63 mainProgram = "lsyncd";
64 license = licenses.gpl2Plus;
65 platforms = platforms.all;
66 maintainers = with maintainers; [ bobvanderlinden ];
67 };
68}