about summary refs log tree commit diff
path: root/grep.nix
diff options
context:
space:
mode:
Diffstat (limited to 'grep.nix')
-rw-r--r--grep.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/grep.nix b/grep.nix
new file mode 100644
index 0000000..6958739
--- /dev/null
+++ b/grep.nix
@@ -0,0 +1,40 @@
+# SPDX-FileCopyrightText: 2003-2012 Eelco Dolstra
+# SPDX-FileCopyrightText: 2009-2011 Ludovic Courtès
+# SPDX-FileCopyrightText: 2009-2010 Rob Vermaas
+# SPDX-FileCopyrightText: 2010 Lluís Batlle i Rossell
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: 2023 Nguyễn Gia Phong
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+{ lib, stdenv, fetchurl, pcre, libiconv }:
+stdenv.mkDerivation rec {
+  pname = "gnugrep";
+  version = "2.11";
+
+  src = fetchurl {
+    url = "mirror://gnu/grep/grep-${version}.tar.xz";
+    sha256 = "sha256-AwMfin39wyimdIMebt+qoHkxKn9BhUUiksaaKj4rDuk=";
+  };
+
+  buildInputs = [ pcre libiconv ];
+
+  # On macOS, force use of mkdir -p, since Grep's fallback
+  # (./install-sh) is broken.
+  preConfigure = ''
+    export MKDIR_P="mkdir -p"
+  '';
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://www.gnu.org/software/grep";
+    description = "GNU implementation of the Unix grep command";
+    longDescription = ''
+      The grep command searches one or more input files for lines
+      containing a match to a specified pattern.  By default, grep
+      prints the matching lines.
+    '';
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+    mainProgram = "grep";
+  };
+}