hred: convert to finalAttrs, add binlore

+8 -6
+8 -6
pkgs/by-name/hr/hred/package.nix
··· 3 3 buildNpmPackage, 4 4 fetchFromGitHub, 5 5 runCommand, 6 - hred, 7 6 jq, 7 + binlore, 8 8 }: 9 9 10 - buildNpmPackage rec { 10 + buildNpmPackage (finalAttrs: { 11 11 pname = "hred"; 12 12 version = "1.5.1"; 13 13 14 14 src = fetchFromGitHub { 15 15 owner = "danburzo"; 16 16 repo = "hred"; 17 - rev = "v${version}"; 17 + rev = "v${finalAttrs.version}"; 18 18 hash = "sha256-+0+WQRI8rdIMbPN0eBUdsWUMWDCxZhTRLiFo1WRd2xc="; 19 19 }; 20 20 ··· 23 23 dontNpmBuild = true; 24 24 25 25 passthru.tests = { 26 - simple = runCommand "${pname}-test" { } '' 26 + simple = runCommand "hred-test" { } '' 27 27 set -e -o pipefail 28 - echo '<i id="foo">bar</i>' | ${hred}/bin/hred 'i#foo { @id => id, @.textContent => text }' -c | ${jq}/bin/jq -c > $out 28 + echo '<i id="foo">bar</i>' | ${finalAttrs.finalPackage}/bin/hred 'i#foo { @id => id, @.textContent => text }' -c | ${jq}/bin/jq -c > $out 29 29 [ "$(cat $out)" = '{"id":"foo","text":"bar"}' ] 30 30 ''; 31 31 }; 32 32 33 + passthru.binlore.out = binlore.synthesize finalAttrs.finalPackage "execer cannot bin/hred"; 34 + 33 35 meta = { 34 36 description = "Command-line tool to extract data from HTML"; 35 37 mainProgram = "hred"; ··· 37 39 homepage = "https://github.com/danburzo/hred"; 38 40 maintainers = with lib.maintainers; [ tejing ]; 39 41 }; 40 - } 42 + })