1{ stdenv, fetchurl, nasm }:
2
3let
4 arch =
5 if stdenv.system == "x86_64-linux" then "bandwidth64"
6 else if stdenv.system == "i686-linux" then "bandwidth32"
7 else if stdenv.system == "x86_64-darwin" then "bandwidth-mac64"
8 else if stdenv.system == "i686-darwin" then "bandwidth-mac32"
9 else if stdenv.system == "i686-cygwin" then "bandwidth-win32"
10 else null;
11in
12stdenv.mkDerivation rec {
13 name = "bandwidth-${version}";
14 version = "1.3.1";
15
16 src = fetchurl {
17 url = "https://mutineer.org/file.php?id=284ebee21bde256fd0daeae91242c2b73d9cf1df&p=bandwidth";
18 name = "${name}.tar.gz";
19 sha256 = "13a0mxrkybpwiynv4cj8wsy8zl5xir5xi1a03fzam5gw815dj4am";
20 };
21
22 buildInputs = [ nasm ];
23
24 buildFlags = [ arch ]
25 ++ stdenv.lib.optionals stdenv.cc.isClang [ "CC=clang" "LD=clang" ];
26
27 installPhase = ''
28 mkdir -p $out/bin
29 cp ${arch} $out/bin
30 ln -s ${arch} $out/bin/bandwidth
31 '';
32
33 meta = with stdenv.lib; {
34 homepage = https://zsmith.co/bandwidth.html;
35 description = "Artificial benchmark for identifying weaknesses in the memory subsystem";
36 license = licenses.mit;
37 platforms = platforms.unix;
38 maintainers = with maintainers; [ nckx wkennington ];
39 };
40}