lol
1{ lib
2, rustPlatform
3, fetchFromGitHub
4, installShellFiles
5}:
6
7rustPlatform.buildRustPackage rec {
8 pname = "snazy";
9 version = "0.52.17";
10
11 src = fetchFromGitHub {
12 owner = "chmouel";
13 repo = pname;
14 rev = version;
15 hash = "sha256-0r5xhmU9a9I+q24mjJ+C4EKK1Nw/67YThuBFibAx3Dw=";
16 };
17
18 cargoHash = "sha256-ljYsF5lBRqiTqx9nta5h/75052GWOBJ9uJnqZkWJvwI=";
19
20 nativeBuildInputs = [ installShellFiles ];
21
22 postInstall = ''
23 installShellCompletion --cmd snazy \
24 --bash <($out/bin/snazy --shell-completion bash) \
25 --fish <($out/bin/snazy --shell-completion fish) \
26 --zsh <($out/bin/snazy --shell-completion zsh)
27 '';
28
29 doInstallCheck = true;
30 installCheckPhase = ''
31 runHook preInstallCheck
32 $out/bin/snazy --help
33 $out/bin/snazy --version | grep "snazy ${version}"
34 runHook postInstallCheck
35 '';
36
37 meta = with lib; {
38 description = "A snazzy json log viewer";
39 mainProgram = "snazy";
40 longDescription = ''
41 Snazy is a simple tool to parse json logs and output them in a nice format
42 with nice colors.
43 '';
44 homepage = "https://github.com/chmouel/snazy/";
45 changelog = "https://github.com/chmouel/snazy/releases/tag/${src.rev}";
46 license = licenses.asl20;
47 maintainers = with maintainers; [ figsoda jk ];
48 };
49}