From 1927efc49b974ff547a166ec5c69bafee49aad47 Mon Sep 17 00:00:00 2001 From: Jeff Huffman Date: Thu, 12 Jan 2023 04:17:23 -0500 Subject: [PATCH] hred: init at 1.5.0 --- pkgs/development/tools/hred/default.nix | 32 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/development/tools/hred/default.nix diff --git a/pkgs/development/tools/hred/default.nix b/pkgs/development/tools/hred/default.nix new file mode 100644 index 000000000000..5e9b7f9122b9 --- /dev/null +++ b/pkgs/development/tools/hred/default.nix @@ -0,0 +1,32 @@ +{ lib, buildNpmPackage, fetchFromGitHub, runCommand, hred, jq }: + +buildNpmPackage rec { + pname = "hred"; + version = "1.5.0"; + + src = fetchFromGitHub { + owner = "danburzo"; + repo = "hred"; + rev = "v${version}"; + hash = "sha256-rnobJG9Z1lXEeFm+c0f9OsbiTzxeP3+zut5LYpGzWfc="; + }; + + npmDepsHash = "sha256-POxlGWK0TJMwNWDpiK5+OXLGtAx4lFJO3imoe/h+7Sc="; + + dontNpmBuild = true; + + passthru.tests = { + simple = runCommand "${pname}-test" {} '' + set -e -o pipefail + echo 'bar' | ${hred}/bin/hred 'i#foo { @id => id, @.textContent => text }' -c | ${jq}/bin/jq -c > $out + [ "$(cat $out)" = '{"id":"foo","text":"bar"}' ] + ''; + }; + + meta = { + description = "A command-line tool to extract data from HTML"; + license = lib.licenses.mit; + homepage = "https://github.com/danburzo/hred"; + maintainers = with lib.maintainers; [ tejing ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f50f92d1994d..3b591a6aea8a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1879,6 +1879,8 @@ with pkgs; gst = callPackage ../applications/version-management/gst { }; + hred = callPackage ../development/tools/hred { }; + hub = callPackage ../applications/version-management/hub { }; hut = callPackage ../applications/version-management/hut { };