Files
nixpkgs/pkgs/by-name/js/jsongrep/package.nix
2026-08-30 23:36:53 +00:00

51 lines
1.3 KiB
Nix

{
fetchFromGitHub,
installShellFiles,
lib,
nix-update-script,
rustPlatform,
stdenvNoCC,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "jsongrep";
version = "0.10.0";
src = fetchFromGitHub {
owner = "micahkepe";
repo = "jsongrep";
tag = "v${finalAttrs.version}";
hash = "sha256-ui5mHYu8CCeJf5hfUMAZe0MiIqB8IskxxUsy77aDNZc=";
};
cargoHash = "sha256-MK4NtLZK3uzyEEQpGXJuoXLRitIpiZKSzkBqDXzbcY8=";
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
for shell in bash fish zsh; do
installShellCompletion --cmd jg \
--"$shell" <("$out"/bin/jg generate shell "$shell")
done
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru.updateScript = nix-update-script { };
meta = {
changelog = "https://github.com/micahkepe/jsongrep/blob/${finalAttrs.src.tag}/CHANGELOG.md";
description = "JSONPath-inspired query language";
longDescription = ''
`jsongrep` is a command-line tool and Rust library for querying
JSON documents using regular path expressions.
'';
homepage = "https://github.com/micahkepe/jsongrep";
license = lib.licenses.mit;
mainProgram = "jg";
maintainers = with lib.maintainers; [ yiyu ];
};
})