about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/agrep/default.nix
blob: c285b892b925b0a5bd45a8f685c2e12829200413 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ stdenv, fetchFromGitHub }:

stdenv.mkDerivation {
  pname = "agrep";
  version = "3.41.5";

  src = fetchFromGitHub {
    owner = "Wikinaut";
    repo = "agrep";
    # This repository has numbered versions, but not Git tags.
    rev = "eef20411d605d9d17ead07a0ade75046f2728e21";
    sha256 = "14addnwspdf2mxpqyrw8b84bb2257y43g5ccy4ipgrr91fmxq2sk";
  };

  # Related: https://github.com/Wikinaut/agrep/pull/11
  prePatch = stdenv.lib.optionalString (stdenv.hostPlatform.isMusl || stdenv.isDarwin) ''
    sed -i '1i#include <sys/stat.h>' checkfil.c newmgrep.c recursiv.c
  '';
  installPhase = ''
    install -Dm 555 agrep -t "$out/bin"
    install -Dm 444 docs/* -t "$out/doc"
  '';

  meta = {
    description = "Approximate grep for fast fuzzy string searching";
    homepage = "https://www.tgries.de/agrep/";
    license = stdenv.lib.licenses.isc;
    platforms = stdenv.lib.platforms.linux;
  };
}