nixpkgs/pkgs/development/tools/snazy/default.nix
2024-01-24 08:15:02 +00:00

49 lines
1.2 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
}:
rustPlatform.buildRustPackage rec {
pname = "snazy";
version = "0.52.7";
src = fetchFromGitHub {
owner = "chmouel";
repo = pname;
rev = version;
hash = "sha256-NUDKTJtSzzY+kaqreHroJDW18lta9AcnL94t/jdEOlY=";
};
cargoHash = "sha256-raDkfP7EeyXbMr2puR+dHUKVqguVvkV7noNuLw/KttI=";
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";
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 ];
};
}