1{ lib
2, stdenv
3, fetchFromGitHub
4, autoreconfHook
5, pkg-config
6, libmysqlclient
7, libaio
8, luajit
9# For testing:
10, testers
11, sysbench
12}:
13
14stdenv.mkDerivation rec {
15 pname = "sysbench";
16 version = "1.0.20";
17
18 nativeBuildInputs = [ autoreconfHook pkg-config ];
19 buildInputs = [ libmysqlclient luajit ] ++ lib.optionals stdenv.isLinux [ libaio ];
20
21 src = fetchFromGitHub {
22 owner = "akopytov";
23 repo = pname;
24 rev = version;
25 sha256 = "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy";
26 };
27
28 enableParallelBuilding = true;
29
30 configureFlags = [
31 # The bundled version does not build on aarch64-darwin:
32 # https://github.com/akopytov/sysbench/issues/416
33 "--with-system-luajit"
34 ];
35
36 passthru.tests = {
37 versionTest = testers.testVersion {
38 package = sysbench;
39 };
40 };
41
42 meta = {
43 description = "Modular, cross-platform and multi-threaded benchmark tool";
44 longDescription = ''
45 sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT.
46 It is most frequently used for database benchmarks, but can also be used
47 to create arbitrarily complex workloads that do not involve a database
48 server.
49 '';
50 homepage = "https://github.com/akopytov/sysbench";
51 downloadPage = "https://github.com/akopytov/sysbench/releases/tag/${version}";
52 changelog = "https://github.com/akopytov/sysbench/blob/${version}/ChangeLog";
53 license = lib.licenses.gpl2;
54 platforms = lib.platforms.unix;
55 };
56}