1{ stdenv, lib, fetchurl, gnuplot }:
2
3let
4 target = if stdenv.hostPlatform.system == "i686-linux" then
5 "linux"
6 else if stdenv.hostPlatform.system == "x86_64-linux" then
7 "linux-AMD64"
8 else if stdenv.hostPlatform.system == "x86_64-darwin" then
9 "macosx"
10 else if stdenv.hostPlatform.system == "aarch64-linux" then
11 "linux-arm"
12 else throw "Platform ${stdenv.hostPlatform.system} not yet supported.";
13in
14
15stdenv.mkDerivation rec {
16 pname = "iozone";
17 version = "3.506";
18
19 src = fetchurl {
20 url = "http://www.iozone.org/src/current/iozone${lib.replaceStrings ["."] ["_"] version}.tar";
21 hash = "sha256-EUzlwHGHO5ose6bnPQXV735mVkOSrL/NwLMmHbEPy+c=";
22 };
23
24 license = fetchurl {
25 url = "http://www.iozone.org/docs/Iozone_License.txt";
26 hash = "sha256-O/8yztxKBI/UKs6vwv9mq16Rn3cf/UHpSxdVnAPVCYw=";
27 };
28
29 preBuild = "pushd src/current";
30 postBuild = "popd";
31
32 buildFlags = target;
33
34 enableParallelBuilding = true;
35
36 installPhase = ''
37 mkdir -p $out/{bin,share/doc,libexec,share/man/man1}
38 install docs/iozone.1 $out/share/man/man1/
39 install docs/Iozone_ps.gz $out/share/doc/
40 install -s src/current/{iozone,fileop,pit_server} $out/bin/
41 install src/current/{gnu3d.dem,Generate_Graphs,gengnuplot.sh} $out/libexec/
42 ln -s $out/libexec/Generate_Graphs $out/bin/iozone_generate_graphs
43 # License copy is mandated by the license, but it's not in the tarball.
44 install ${license} $out/share/doc/Iozone_License.txt
45 '';
46
47 preFixup = ''
48 sed -i "1i#! $shell" $out/libexec/Generate_Graphs
49 substituteInPlace $out/libexec/Generate_Graphs \
50 --replace ./gengnuplot.sh $out/libexec/gengnuplot.sh \
51 --replace 'gnuplot ' "${gnuplot}/bin/gnuplot " \
52 --replace gnu3d.dem $out/libexec/gnu3d.dem
53 '';
54
55 meta = {
56 description = "IOzone Filesystem Benchmark";
57 homepage = "http://www.iozone.org/";
58 license = lib.licenses.unfreeRedistributable;
59 platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
60 maintainers = with lib.maintainers; [ Baughn makefu ];
61 };
62}