nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 luajit,
6 openssl,
7 zlib,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "wrk2";
12 version = "4.0.0-${builtins.substring 0 7 src.rev}";
13
14 src = fetchFromGitHub {
15 owner = "giltene";
16 repo = "wrk2";
17 rev = "e0109df5b9de09251adb5f5848f223fbee2aa9f5";
18 sha256 = "1aqdwmgdd74wq73f1zp28yqj91gd6p6nf9nbdfibl7mlklbzvak8";
19 };
20
21 buildInputs = [
22 luajit
23 openssl
24 zlib
25 ];
26
27 patchPhase = ''
28 rm -rf deps/luajit && mkdir deps/luajit
29
30 substituteInPlace ./Makefile \
31 --replace '-lluajit' '-lluajit-5.1' \
32 --replace '_BSD_SOURCE' '_DEFAULT_SOURCE' \
33 --replace 'cd $(LDIR) && ./luajit' '${luajit}/bin/luajit' \
34 --replace 'config.h Makefile $(LDIR)/libluajit.a' 'config.h Makefile'
35
36 substituteInPlace ./src/script.c \
37 --replace 'struct luaL_reg ' 'struct luaL_Reg '
38 '';
39
40 dontConfigure = true;
41 installPhase = ''
42 mkdir -p $out/bin
43 mv ./wrk $out/bin/wrk2
44 '';
45
46 meta = {
47 description = "Constant throughput, correct latency recording variant of wrk";
48 homepage = "https://github.com/giltene/wrk2";
49 license = lib.licenses.bsd3;
50 platforms = lib.platforms.linux;
51 maintainers = with lib.maintainers; [ thoughtpolice ];
52 # never built on aarch64-linux since first introduction in nixpkgs
53 broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
54 mainProgram = "wrk2";
55 };
56}