From d775f12b8d0d00801090981bff6c3e718f062f1d Mon Sep 17 00:00:00 2001 From: Yiyu Zhou Date: Mon, 2 Feb 2026 09:36:22 -0800 Subject: [PATCH] jsongrep: init at 0.8.1 --- pkgs/by-name/js/jsongrep/package.nix | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkgs/by-name/js/jsongrep/package.nix diff --git a/pkgs/by-name/js/jsongrep/package.nix b/pkgs/by-name/js/jsongrep/package.nix new file mode 100644 index 000000000000..3f2b6bd2d40f --- /dev/null +++ b/pkgs/by-name/js/jsongrep/package.nix @@ -0,0 +1,50 @@ +{ + fetchFromGitHub, + installShellFiles, + lib, + nix-update-script, + rustPlatform, + stdenvNoCC, + versionCheckHook, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "jsongrep"; + version = "0.8.1"; + + src = fetchFromGitHub { + owner = "micahkepe"; + repo = "jsongrep"; + tag = "v${finalAttrs.version}"; + hash = "sha256-A4cBHIRXmjpRSJtUNNPGOfSOFQG4om5QFa9xw4MeYj8="; + }; + + cargoHash = "sha256-RQLMQ2jEtqh7km4FWhBaWuw9QY4B4O50DbPdBO+hcW4="; + + 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 ]; + }; +})