nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 95 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 autoreconfHook, 6 pkg-config, 7 libmysqlclient, 8 libaio, 9 luajit, 10 # For testing: 11 testers, 12 sysbench, 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "sysbench"; 17 version = "1.0.20"; 18 19 nativeBuildInputs = [ 20 autoreconfHook 21 pkg-config 22 ]; 23 buildInputs = [ 24 libmysqlclient 25 luajit 26 ] 27 ++ lib.optionals stdenv.hostPlatform.isLinux [ libaio ]; 28 depsBuildBuild = [ pkg-config ]; 29 30 src = fetchFromGitHub { 31 owner = "akopytov"; 32 repo = "sysbench"; 33 rev = finalAttrs.version; 34 sha256 = "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy"; 35 }; 36 37 enableParallelBuilding = true; 38 39 configureFlags = [ 40 # The bundled version does not build on aarch64-darwin: 41 # https://github.com/akopytov/sysbench/issues/416 42 "--with-system-luajit" 43 "--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql" 44 "--with-mysql-libs=${libmysqlclient}/lib/mysql" 45 ]; 46 47 # We cannot use the regular nixpkgs ck here, since it has very 48 # different performance characteristics than the vendored one. 49 # On the downside the vendored libck version require more fixes for cross-compilation. 50 # Sysbench related on statically linked vendored libck. 51 postPatch = '' 52 substituteInPlace \ 53 third_party/concurrency_kit/ck/configure \ 54 --replace-fail \ 55 'COMPILER=`./.1 2> /dev/null`' \ 56 "COMPILER=${ 57 if stdenv.cc.isGNU then 58 "gcc" 59 else if stdenv.cc.isClang then 60 "clang" 61 else 62 throw "Unsupported compiler" 63 }" \ 64 --replace-fail \ 65 'PLATFORM=`uname -m 2> /dev/null`' \ 66 "PLATFORM=${stdenv.hostPlatform.parsed.cpu.name}" 67 substituteInPlace \ 68 third_party/concurrency_kit/ck/src/Makefile.in \ 69 --replace-fail \ 70 "ar rcs" \ 71 "${stdenv.cc.targetPrefix}ar rcs" 72 ''; 73 74 passthru.tests = { 75 versionTest = testers.testVersion { 76 package = sysbench; 77 }; 78 }; 79 80 meta = { 81 description = "Modular, cross-platform and multi-threaded benchmark tool"; 82 mainProgram = "sysbench"; 83 longDescription = '' 84 sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT. 85 It is most frequently used for database benchmarks, but can also be used 86 to create arbitrarily complex workloads that do not involve a database 87 server. 88 ''; 89 homepage = "https://github.com/akopytov/sysbench"; 90 downloadPage = "https://github.com/akopytov/sysbench/releases/tag/${finalAttrs.version}"; 91 changelog = "https://github.com/akopytov/sysbench/blob/${finalAttrs.version}/ChangeLog"; 92 license = lib.licenses.gpl2; 93 platforms = lib.platforms.unix; 94 }; 95})