nixpkgs/pkgs/tools/text/sgrep/default.nix
Alexis Hildebrandt 755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00

41 lines
1.2 KiB
Nix

{ stdenv, sgrep, fetchurl, runCommand, lib, m4, makeWrapper }:
stdenv.mkDerivation rec {
pname = "sgrep";
version = "1.94a";
src = fetchurl {
url = "https://www.cs.helsinki.fi/pub/Software/Local/Sgrep/sgrep-${version}.tar.gz";
sha256 = "sha256-1bFkeOOrRHNeJCg9LYldLJyAE5yVIo3zvbKsRGOV+vk=";
};
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/sgrep \
--prefix PATH : ${lib.makeBinPath [ m4 ]}
'';
passthru.tests.smokeTest = runCommand "test-sgrep" { } ''
expr='"<foo>" __ "</foo>"'
data="<foo>1</foo><bar>2</bar>"
${sgrep}/bin/sgrep "$expr" <<<$data >$out
read result <$out
[[ $result = 1 ]]
'';
meta = with lib; {
homepage = "https://www.cs.helsinki.fi/u/jjaakkol/sgrep.html";
description = "Grep for structured text formats such as XML";
mainProgram = "sgrep";
longDescription = ''
sgrep (structured grep) is a tool for searching and indexing text,
SGML, XML and HTML files and filtering text streams using
structural criteria.
'';
platforms = platforms.unix;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ eigengrau ];
};
}