nixpkgs-suyu/pkgs/development/tools/k6/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

40 lines
1.1 KiB
Nix

{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "k6";
version = "0.49.0";
src = fetchFromGitHub {
owner = "grafana";
repo = pname;
rev = "v${version}";
hash = "sha256-zlsHEAGsey+qe0s7sle9Kt/V0hTp6uzelJmRlATznUY=";
};
subPackages = [ "./" ];
vendorHash = null;
nativeBuildInputs = [ installShellFiles ];
doInstallCheck = true;
installCheckPhase = ''
$out/bin/k6 version | grep ${version} > /dev/null
'';
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
installShellCompletion --cmd k6 \
--bash <($out/bin/k6 completion bash) \
--fish <($out/bin/k6 completion fish) \
--zsh <($out/bin/k6 completion zsh)
'';
meta = with lib; {
description = "A modern load testing tool, using Go and JavaScript";
mainProgram = "k6";
homepage = "https://k6.io/";
changelog = "https://github.com/grafana/k6/releases/tag/v${version}";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ offline bryanasdev000 kashw2 ];
};
}