diff options
author | Ivan Kozik <ivan@ludios.org> | 2022-10-20 03:06:49 +0000 |
---|---|---|
committer | Ivan Kozik <ivan@ludios.org> | 2022-10-22 05:10:35 +0000 |
commit | 21ad24291d35d6199bd988d54fec846232a03e57 (patch) | |
tree | f7986e38a406ce56d7b9f11079d257788004e645 /pkgs/tools/text/sorted-grep | |
parent | ba90bab628277d977d3a381e91d4ce0af4ea4f91 (diff) |
sorted-grep: init at 1.0
This is https://sgrep.sourceforge.net/, which is quite useful for finding lines in very large sorted files.
Diffstat (limited to 'pkgs/tools/text/sorted-grep')
-rw-r--r-- | pkgs/tools/text/sorted-grep/default.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/tools/text/sorted-grep/default.nix b/pkgs/tools/text/sorted-grep/default.nix new file mode 100644 index 0000000000000..60bc0bee676fa --- /dev/null +++ b/pkgs/tools/text/sorted-grep/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + pname = "sorted-grep"; + version = "1.0"; + + src = fetchurl { + url = "mirror://sourceforge/sgrep/sgrep-${version}.tgz"; + hash = "sha256-3F7cXrZnB38YwE1sHYm/CIGKmG+1c0QU+Pk3Y53a0T4="; + }; + + postPatch = '' + # Its Makefile is missing compiler flags and an install step + rm -f Makefile + ''; + + buildPhase = '' + runHook preBuild + + ${stdenv.cc.targetPrefix}cc -Wall -O2 -o sgrep sgrep.c + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -D sgrep "$out/bin/sgrep" + + runHook postInstall + ''; + + installCheckPhase = '' + runHook preInstallCheck + + set +o pipefail + $out/bin/sgrep 2>&1 | grep ^Usage: + + runHook postInstallCheck + ''; + + doInstallCheck = true; + + meta = with lib; { + homepage = "https://sgrep.sourceforge.net/"; + description = "Sgrep (sorted grep) searches sorted input files for lines that match a search key"; + longDescription = '' + Sgrep (sorted grep) searches sorted input files for lines that match a search + key and outputs the matching lines. When searching large files sgrep is much + faster than traditional Unix grep, but with significant restrictions. + ''; + platforms = platforms.unix; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ ivan ]; + }; +} |