1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 bison,
6 boost,
7 cmake,
8 makeWrapper,
9 pkg-config,
10 curl,
11 cyrus_sasl,
12 libaio,
13 libedit,
14 libev,
15 libevent,
16 libgcrypt,
17 libgpg-error,
18 lz4,
19 ncurses,
20 numactl,
21 openssl,
22 procps,
23 protobuf,
24 valgrind,
25 xxd,
26 zlib,
27 perlPackages,
28 version,
29 hash,
30 fetchSubmodules ? false,
31 extraPatches ? [ ],
32 extraPostInstall ? "",
33 ...
34}:
35
36stdenv.mkDerivation (finalAttrs: {
37 pname = "percona-xtrabackup";
38 inherit version;
39
40 src = fetchFromGitHub {
41 owner = "percona";
42 repo = "percona-xtrabackup";
43 rev = "percona-xtrabackup-${finalAttrs.version}";
44 inherit hash fetchSubmodules;
45 };
46
47 nativeBuildInputs = [
48 bison
49 boost
50 cmake
51 makeWrapper
52 pkg-config
53 ];
54
55 buildInputs = [
56 (curl.override { inherit openssl; })
57 cyrus_sasl
58 libaio
59 libedit
60 libevent
61 libev
62 libgcrypt
63 libgpg-error
64 lz4
65 ncurses
66 numactl
67 openssl
68 procps
69 protobuf
70 valgrind
71 xxd
72 zlib
73 ]
74 ++ (with perlPackages; [
75 perl
76 DBI
77 DBDmysql
78 ]);
79
80 patches = extraPatches;
81
82 cmakeFlags = [
83 "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
84 "-DBUILD_CONFIG=xtrabackup_release"
85 "-DINSTALL_MYSQLTESTDIR=OFF"
86 "-DWITH_BOOST=system"
87 "-DWITH_CURL=system"
88 "-DWITH_EDITLINE=system"
89 "-DWITH_LIBEVENT=system"
90 "-DWITH_LZ4=system"
91 "-DWITH_PROTOBUF=system"
92 "-DWITH_SASL=system"
93 "-DWITH_SSL=system"
94 "-DWITH_ZLIB=system"
95 "-DWITH_VALGRIND=ON"
96 "-DWITH_MAN_PAGES=OFF"
97 ];
98
99 postInstall = ''
100 wrapProgram "$out"/bin/xtrabackup --prefix PERL5LIB : $PERL5LIB
101 rm -r "$out"/lib/plugin/debug
102 ''
103 + extraPostInstall;
104
105 passthru.mysqlVersion = lib.versions.majorMinor finalAttrs.version;
106
107 meta = with lib; {
108 description = "Non-blocking backup tool for MySQL";
109 homepage = "http://www.percona.com/software/percona-xtrabackup";
110 license = licenses.gpl2Only;
111 platforms = platforms.linux;
112 maintainers = [ maintainers.izorkin ];
113 teams = [ teams.flyingcircus ];
114 };
115})