From 9fd235b40a992d33c3e30956485a7a893ed093bc Mon Sep 17 00:00:00 2001 From: Rahul Butani Date: Fri, 19 Aug 2022 07:39:45 -0500 Subject: [PATCH] sysbench: add macOS support (#185750) Co-authored-by: Sandro --- .../tools/misc/sysbench/default.nix | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/misc/sysbench/default.nix b/pkgs/development/tools/misc/sysbench/default.nix index 2cf8c91d3bf9..1e15c6ab0f2f 100644 --- a/pkgs/development/tools/misc/sysbench/default.nix +++ b/pkgs/development/tools/misc/sysbench/default.nix @@ -1,5 +1,14 @@ -{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config -, libmysqlclient, libaio +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, pkg-config +, libmysqlclient +, libaio +, luajit +# For testing: +, testers +, sysbench }: stdenv.mkDerivation rec { @@ -7,7 +16,7 @@ stdenv.mkDerivation rec { version = "1.0.20"; nativeBuildInputs = [ autoreconfHook pkg-config ]; - buildInputs = [ libmysqlclient libaio ]; + buildInputs = [ libmysqlclient luajit ] ++ lib.optionals stdenv.isLinux [ libaio ]; src = fetchFromGitHub { owner = "akopytov"; @@ -18,10 +27,30 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + configureFlags = [ + # The bundled version does not build on aarch64-darwin: + # https://github.com/akopytov/sysbench/issues/416 + "--with-system-luajit" + ]; + + passthru.tests = { + versionTest = testers.testVersion { + package = sysbench; + }; + }; + meta = { description = "Modular, cross-platform and multi-threaded benchmark tool"; + longDescription = '' + sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT. + It is most frequently used for database benchmarks, but can also be used + to create arbitrarily complex workloads that do not involve a database + server. + ''; homepage = "https://github.com/akopytov/sysbench"; + downloadPage = "https://github.com/akopytov/sysbench/releases/tag/${version}"; + changelog = "https://github.com/akopytov/sysbench/blob/${version}/ChangeLog"; license = lib.licenses.gpl2; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; }; }