Skip to content

Commit

Permalink
Merge pull request #180874 from eigengrau/add-sgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored Aug 19, 2022
2 parents 8abd14f + 3768105 commit 4b78546
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pkgs/tools/text/sgrep/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ 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 = "A grep for structured text formats such as XML";
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 ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,8 @@ with pkgs;

sdlookup = callPackage ../tools/security/sdlookup { };

sgrep = callPackage ../tools/text/sgrep { };

smbscan = callPackage ../tools/security/smbscan { };

spectre-cli = callPackage ../tools/security/spectre-cli { };
Expand Down

0 comments on commit 4b78546

Please sign in to comment.