nixpkgs/pkgs/by-name/sn/snazy/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

51 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
}:
rustPlatform.buildRustPackage rec {
pname = "snazy";
version = "0.54.0";
src = fetchFromGitHub {
owner = "chmouel";
repo = pname;
rev = version;
hash = "sha256-1+UbUwvv5HWiQ+u9gPtJ3JwP6cMi4IZOCSMedXzWEoQ=";
};
cargoHash = "sha256-NmnKWVyD+NrP7ReERQB1/K8hyrSFj6qgjQjYwxZc+OY=";
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
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 = "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 ];
};
}