1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 meson,
6 ninja,
7 pkg-config,
8 python3,
9 sphinx,
10 acl,
11 curl,
12 fuse,
13 libselinux,
14 udev,
15 xz,
16 zstd,
17 fuseSupport ? true,
18 selinuxSupport ? true,
19 udevSupport ? true,
20 glibcLocales,
21 rsync,
22 udevCheckHook,
23}:
24
25stdenv.mkDerivation {
26 pname = "casync";
27 version = "2-unstable-2023-10-16";
28
29 src = fetchFromGitHub {
30 owner = "systemd";
31 repo = "casync";
32 rev = "e6817a79d89b48e1c6083fb1868a28f1afb32505";
33 hash = "sha256-L7I80kSG4/ES2tGvHHgvOxJZzF76yeqy2WquKCPhnFk=";
34 };
35
36 buildInputs = [
37 acl
38 curl
39 xz
40 zstd
41 ]
42 ++ lib.optionals fuseSupport [ fuse ]
43 ++ lib.optionals selinuxSupport [ libselinux ]
44 ++ lib.optionals udevSupport [ udev ];
45 nativeBuildInputs = [
46 meson
47 ninja
48 pkg-config
49 python3
50 sphinx
51 ];
52 nativeCheckInputs = [
53 glibcLocales
54 rsync
55 ]
56 ++ lib.optionals udevSupport [
57 udevCheckHook
58 ];
59
60 postPatch = ''
61 for f in test/test-*.sh.in; do
62 patchShebangs $f
63 done
64 patchShebangs test/http-server.py
65 '';
66
67 PKG_CONFIG_UDEV_UDEVDIR = "lib/udev";
68 mesonFlags =
69 lib.optionals (!fuseSupport) [ "-Dfuse=false" ]
70 ++ lib.optionals (!udevSupport) [ "-Dudev=false" ]
71 ++ lib.optionals (!selinuxSupport) [ "-Dselinux=false" ];
72
73 doCheck = true;
74 preCheck = ''
75 export LC_ALL="en_US.utf-8"
76 '';
77
78 doInstallCheck = true;
79
80 meta = with lib; {
81 description = "Content-Addressable Data Synchronizer";
82 mainProgram = "casync";
83 homepage = "https://github.com/systemd/casync";
84 license = licenses.lgpl21Plus;
85 platforms = platforms.linux;
86 maintainers = with maintainers; [ flokli ];
87 };
88}