nixpkgs/pkgs/by-name/so/sorted-grep/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

58 lines
1.3 KiB
Nix

{ 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";
mainProgram = "sgrep";
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 ];
};
}