1{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
2
3buildGoModule rec {
4 pname = "k6";
5 version = "0.52.0";
6
7 src = fetchFromGitHub {
8 owner = "grafana";
9 repo = pname;
10 rev = "v${version}";
11 hash = "sha256-OgIU+xWkQnU+ngeMrOkMFaQuvcMfVzKvukcJTgInyxM=";
12 };
13
14 subPackages = [ "./" ];
15
16 vendorHash = null;
17
18 nativeBuildInputs = [ installShellFiles ];
19
20 doInstallCheck = true;
21 installCheckPhase = ''
22 $out/bin/k6 version | grep ${version} > /dev/null
23 '';
24
25 postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
26 installShellCompletion --cmd k6 \
27 --bash <($out/bin/k6 completion bash) \
28 --fish <($out/bin/k6 completion fish) \
29 --zsh <($out/bin/k6 completion zsh)
30 '';
31
32 meta = with lib; {
33 description = "Modern load testing tool, using Go and JavaScript";
34 mainProgram = "k6";
35 homepage = "https://k6.io/";
36 changelog = "https://github.com/grafana/k6/releases/tag/v${version}";
37 license = licenses.agpl3Plus;
38 maintainers = with maintainers; [ offline bryanasdev000 kashw2 ];
39 };
40}