nixpkgs/pkgs/development/tools/snazy/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

49 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
}:
rustPlatform.buildRustPackage rec {
pname = "snazy";
version = "0.52.17";
src = fetchFromGitHub {
owner = "chmouel";
repo = pname;
rev = version;
hash = "sha256-0r5xhmU9a9I+q24mjJ+C4EKK1Nw/67YThuBFibAx3Dw=";
};
cargoHash = "sha256-ljYsF5lBRqiTqx9nta5h/75052GWOBJ9uJnqZkWJvwI=";
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd snazy \
--bash <($out/bin/snazy --shell-completion bash) \
--fish <($out/bin/snazy --shell-completion fish) \
--zsh <($out/bin/snazy --shell-completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/snazy --help
$out/bin/snazy --version | grep "snazy ${version}"
runHook postInstallCheck
'';
meta = with lib; {
description = "A snazzy json log viewer";
mainProgram = "snazy";
longDescription = ''
Snazy is a simple tool to parse json logs and output them in a nice format
with nice colors.
'';
homepage = "https://github.com/chmouel/snazy/";
changelog = "https://github.com/chmouel/snazy/releases/tag/${src.rev}";
license = licenses.asl20;
maintainers = with maintainers; [ figsoda jk ];
};
}