about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text')
-rw-r--r--nixpkgs/pkgs/tools/text/a2ps/default.nix47
-rw-r--r--nixpkgs/pkgs/tools/text/agrep/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/aha/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/amber/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/text/ansifilter/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/text/ascii/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/text/bcat/Gemfile2
-rw-r--r--nixpkgs/pkgs/tools/text/bcat/Gemfile.lock15
-rw-r--r--nixpkgs/pkgs/tools/text/bcat/default.nix17
-rw-r--r--nixpkgs/pkgs/tools/text/bcat/gemset.nix23
-rw-r--r--nixpkgs/pkgs/tools/text/boxes/default.nix47
-rw-r--r--nixpkgs/pkgs/tools/text/catdoc/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/text/catdocx/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/cconv/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/codesearch/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/codesearch/deps.nix3
-rw-r--r--nixpkgs/pkgs/tools/text/colordiff/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/coloursum/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/convertlit/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/text/copyright-update/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/csvkit/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/text/dadadodo/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/diction/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/text/diffr/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/diffstat/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/diffutils/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/discount/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/text/discount/fix-configure-path.patch12
-rw-r--r--nixpkgs/pkgs/tools/text/dos2unix/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/text/ebook-tools/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/enca/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/enscript/default.nix43
-rw-r--r--nixpkgs/pkgs/tools/text/epubcheck/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/text/esh/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/text/fanficfare/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/gawk/default.nix84
-rw-r--r--nixpkgs/pkgs/tools/text/gawk/gawk-with-extensions.nix12
-rw-r--r--nixpkgs/pkgs/tools/text/gawk/gawkextlib.nix149
-rw-r--r--nixpkgs/pkgs/tools/text/gawk/setup-hook.sh6
-rw-r--r--nixpkgs/pkgs/tools/text/gist/default.nix17
-rw-r--r--nixpkgs/pkgs/tools/text/glogg/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/gnugrep/default.nix61
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/Allow_input_files_to_be_missing_for_ed-style_patches.patch33
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-1000156.patch211
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6951.patch28
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6952.patch28
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13636.patch108
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13638-and-CVE-2018-20969.patch38
-rw-r--r--nixpkgs/pkgs/tools/text/gnupatch/default.nix58
-rw-r--r--nixpkgs/pkgs/tools/text/gnused/422.nix33
-rw-r--r--nixpkgs/pkgs/tools/text/gnused/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/text/grin/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/grip-search/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/text/groff/0001-Fix-cross-compilation-by-looking-for-ar.patch46
-rw-r--r--nixpkgs/pkgs/tools/text/groff/default.nix130
-rw-r--r--nixpkgs/pkgs/tools/text/groff/site.tmac16
-rw-r--r--nixpkgs/pkgs/tools/text/gtranslator/default.nix74
-rw-r--r--nixpkgs/pkgs/tools/text/gucci/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/gucci/deps.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/highlight/default.nix58
-rw-r--r--nixpkgs/pkgs/tools/text/html-tidy/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/html2text/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/hyx/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/hyx/no-wall-by-default.patch11
-rw-r--r--nixpkgs/pkgs/tools/text/icdiff/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/text/invoice2data/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/default.nix58
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0007-Use-termios.patch188
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0008-Tex-backslash.patch48
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0009-Fix-FTBFS-on-glibc.patch23
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0011-Missing-prototypes.patch84
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0012-Fix-getline.patch62
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0013-Fix-man-pages.patch227
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0021-Fix-gcc-warnings.patch57
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0023-Exclusive-options.patch38
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0024-Check-tempdir-creation.patch69
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0025-Languages.patch81
-rw-r--r--nixpkgs/pkgs/tools/text/ispell/patches/0030-Display-whole-multibyte-character.patch35
-rw-r--r--nixpkgs/pkgs/tools/text/jsawk/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/jumanpp/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/kakasi/default.nix34
-rw-r--r--nixpkgs/pkgs/tools/text/kdiff3/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile2
-rw-r--r--nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile.lock17
-rw-r--r--nixpkgs/pkgs/tools/text/kramdown-rfc2629/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/text/kramdown-rfc2629/gemset.nix33
-rw-r--r--nixpkgs/pkgs/tools/text/kytea/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/kytea/gcc-O3.patch13
-rw-r--r--nixpkgs/pkgs/tools/text/languagetool/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/text/link-grammar/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/lv/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/text/mairix/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/mairix/mmap.patch161
-rw-r--r--nixpkgs/pkgs/tools/text/markdown-pp/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/mawk/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/mb2md/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/text/mdbook/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/mdcat/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/text/mecab/base.nix16
-rw-r--r--nixpkgs/pkgs/tools/text/mecab/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/text/mecab/ipadic.nix18
-rw-r--r--nixpkgs/pkgs/tools/text/mecab/nodic.nix8
-rw-r--r--nixpkgs/pkgs/tools/text/miller/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/mir-qualia/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/mpage/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/data/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/libbtree/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/libfacet/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/libmtquery/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/libmtsupport/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/text/multitran/mtutils/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/namazu/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/text/nawk/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/text/nkf/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/numdiff/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/text/ocrmypdf/default.nix107
-rw-r--r--nixpkgs/pkgs/tools/text/ocrmypdf/liblept.patch13
-rw-r--r--nixpkgs/pkgs/tools/text/odt2txt/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/text/opencc/default.nix39
-rwxr-xr-xnixpkgs/pkgs/tools/text/papertrail/Gemfile4
-rw-r--r--nixpkgs/pkgs/tools/text/papertrail/Gemfile.lock17
-rw-r--r--nixpkgs/pkgs/tools/text/papertrail/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/papertrail/gemset.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/par/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/text/patchutils/0.3.3.nix7
-rw-r--r--nixpkgs/pkgs/tools/text/patchutils/default.nix6
-rw-r--r--nixpkgs/pkgs/tools/text/patchutils/drop-comments.patch84
-rw-r--r--nixpkgs/pkgs/tools/text/patchutils/generic.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/peco/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/peco/deps.nix57
-rw-r--r--nixpkgs/pkgs/tools/text/platinum-searcher/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/platinum-searcher/deps.nix83
-rw-r--r--nixpkgs/pkgs/tools/text/podiff/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/poedit/default.nix46
-rw-r--r--nixpkgs/pkgs/tools/text/popfile/default.nix59
-rw-r--r--nixpkgs/pkgs/tools/text/proselint/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/text/qgrep/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/text/qprint/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/qshowdiff/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/reckon/Gemfile2
-rw-r--r--nixpkgs/pkgs/tools/text/reckon/Gemfile.lock21
-rw-r--r--nixpkgs/pkgs/tools/text/reckon/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/reckon/gemset.nix42
-rw-r--r--nixpkgs/pkgs/tools/text/recode/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/replace/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/replace/malloc.patch13
-rw-r--r--nixpkgs/pkgs/tools/text/ripgrep-all/default.nix63
-rw-r--r--nixpkgs/pkgs/tools/text/ripgrep/default.nix46
-rw-r--r--nixpkgs/pkgs/tools/text/rosie/default.nix47
-rw-r--r--nixpkgs/pkgs/tools/text/rpl/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/text/rs/default.nix52
-rw-r--r--nixpkgs/pkgs/tools/text/rst2html5/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile2
-rw-r--r--nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile.lock24
-rw-r--r--nixpkgs/pkgs/tools/text/ruby-zoom/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/text/ruby-zoom/gemset.nix64
-rw-r--r--nixpkgs/pkgs/tools/text/ruplacer/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/schema2ldif/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/text/sd/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/sgml/jade/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/text/sgml/openjade/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/sgml/openjade/msggen.patch34
-rw-r--r--nixpkgs/pkgs/tools/text/sgml/opensp/default.nix47
-rw-r--r--nixpkgs/pkgs/tools/text/sgml/opensp/setup-hook.sh22
-rw-r--r--nixpkgs/pkgs/tools/text/shab/default.nix73
-rw-r--r--nixpkgs/pkgs/tools/text/shfmt/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/shocco/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/sift/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/sift/deps.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/silver-searcher/bash-completion.patch5
-rw-r--r--nixpkgs/pkgs/tools/text/silver-searcher/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/smu/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/snippetpixie/default.nix93
-rw-r--r--nixpkgs/pkgs/tools/text/source-highlight/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/tab/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/text/transifex-client/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/text/txt2tags/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/text/uni2ascii/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/text/unoconv/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/text/unrtf/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/text/untex/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/text/vale/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/text/wdiff/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/text/wgetpaste/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/text/xidel/default.nix49
-rw-r--r--nixpkgs/pkgs/tools/text/xml/basex/basex.svg81
-rw-r--r--nixpkgs/pkgs/tools/text/xml/basex/default.nix73
-rw-r--r--nixpkgs/pkgs/tools/text/xml/html-xml-utils/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/text/xml/jing-trang/default.nix43
-rw-r--r--nixpkgs/pkgs/tools/text/xml/rnv/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/text/xml/rxp/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/text/xml/xml2/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/text/xml/xmlformat/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/xml/xmloscopy/default.nix53
-rw-r--r--nixpkgs/pkgs/tools/text/xml/xmlstarlet/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/text/xml/xpf/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/text/xsv/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/text/xurls/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/text/yaml-merge/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/text/zimreader/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/text/zimwriterfs/default.nix43
201 files changed, 7463 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/text/a2ps/default.nix b/nixpkgs/pkgs/tools/text/a2ps/default.nix
new file mode 100644
index 000000000000..39f1b7e5bc2c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/a2ps/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, fetchpatch, autoconf, bison, libpaper, gperf, file, perl }:
+
+stdenv.mkDerivation rec {
+  name = "a2ps-4.14";
+  src = fetchurl {
+    url = "mirror://gnu/a2ps/${name}.tar.gz";
+    sha256 = "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/a/a2ps/1:4.14-1.3/debian/patches/09_CVE-2001-1593.diff";
+      sha256 = "1hrfmvb21zlklmg2fqikgywhqgc4qnvbhx517w87faafrhzhlnh0";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/a/a2ps/1:4.14-1.3/debian/patches/CVE-2014-0466.diff";
+      sha256 = "0grqqsc3m45niac56m19m5gx7gc0m8zvia5iman1l4rlq31shf8s";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.net/data/main/a/a2ps/1:4.14-1.3/debian/patches/fix-format-security.diff";
+      sha256 = "0pq7zl41gf2kc6ahwyjnzn93vbxb4jc2c5g8j20isp4vw6dqrnwv";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace afm/make_fonts_map.sh --replace "/bin/rm" "rm"
+    substituteInPlace tests/defs.in --replace "/bin/rm" "rm"
+  '';
+
+  nativeBuildInputs = [ autoconf file bison perl ];
+  buildInputs = [ libpaper gperf ];
+
+  meta = with stdenv.lib; {
+    description = "An Anything to PostScript converter and pretty-printer";
+    longDescription = ''
+      GNU a2ps converts files into PostScript for printing or viewing. It uses a nice default format,
+      usually two pages on each physical page, borders surrounding pages, headers with useful information
+      (page number, printing date, file name or supplied header), line numbering, symbol substitution as
+      well as pretty printing for a wide range of programming languages.
+    '';
+    homepage = "https://www.gnu.org/software/a2ps/";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.bennofs ];
+    platforms = platforms.linux;
+
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/agrep/default.nix b/nixpkgs/pkgs/tools/text/agrep/default.nix
new file mode 100644
index 000000000000..c285b892b925
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/agrep/default.nix
@@ -0,0 +1,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;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/aha/default.nix b/nixpkgs/pkgs/tools/text/aha/default.nix
new file mode 100644
index 000000000000..a823f37d8d2c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/aha/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "aha";
+  version = "0.5";
+
+  src = fetchFromGitHub {
+    sha256 = "0byml4rmpiaalwx69jcixl3yvpvwmwiss1jzgsqwshilb2p4qnmz";
+    rev = version;
+    repo = "aha";
+    owner = "theZiz";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "ANSI HTML Adapter";
+    longDescription = ''
+      aha takes ANSI SGR-coloured input and produces W3C-conformant HTML code.
+    '';
+    homepage = "https://github.com/theZiz/aha";
+    license = with licenses; [ lgpl2Plus mpl11 ];
+    maintainers = with maintainers; [ pSub ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/amber/default.nix b/nixpkgs/pkgs/tools/text/amber/default.nix
new file mode 100644
index 000000000000..4afab278370c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/amber/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, rustPlatform
+, Security
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "amber";
+  version = "0.5.4";
+
+  src = fetchFromGitHub {
+    owner = "dalance";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0pqz3spb5lmrj7w8hynmah9nrcfjsb1s0bmrr0cng9a9jx8amwzn";
+  };
+
+  cargoSha256 = "1ps70swh96xbfn4hng5krlmwvw2bwrl2liqvx9v9vy6pr86643s6";
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  meta = with stdenv.lib; {
+    description = "A code search-and-replace tool";
+    homepage = "https://github.com/dalance/amber";
+    license = with licenses; [ mit ];
+    maintainers = [ maintainers.bdesham ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ansifilter/default.nix b/nixpkgs/pkgs/tools/text/ansifilter/default.nix
new file mode 100644
index 000000000000..8ebb5cfd059b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ansifilter/default.nix
@@ -0,0 +1,31 @@
+{ fetchurl, stdenv, pkgconfig, boost, lua }:
+
+stdenv.mkDerivation rec {
+  pname = "ansifilter";
+  version = "2.16";
+
+  src = fetchurl {
+    url = "http://www.andre-simon.de/zip/ansifilter-${version}.tar.bz2";
+    sha256 = "1wmszcykhaipxa7kxj4ml0lkmd5z7i9ryaachg9jpkhbaaijzkbz";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ boost lua ];
+
+  makeFlags = [
+    "PREFIX=${placeholder "out"}"
+    "conf_dir=/etc/ansifilter"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Tool to convert ANSI to other formats";
+    longDescription = ''
+      Tool to remove ANSI or convert them to another format
+      (HTML, TeX, LaTeX, RTF, Pango or BBCode)
+    '';
+    homepage = "http://www.andre-simon.de/doku/ansifilter/en/ansifilter.php";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.Adjective-Object ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ascii/default.nix b/nixpkgs/pkgs/tools/text/ascii/default.nix
new file mode 100644
index 000000000000..94ab5286f8c0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ascii/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "ascii";
+  version = "3.18";
+
+  src = fetchurl {
+    url = "http://www.catb.org/~esr/ascii/${pname}-${version}.tar.gz";
+    sha256 = "0b87vy06s8s3a8q70pqavsbk4m4ff034sdml2xxa6qfsykaj513j";
+  };
+
+  prePatch = ''
+    sed -i -e "s|^PREFIX = .*|PREFIX = $out|" Makefile
+  '';
+
+  preInstall = ''
+    mkdir -vp "$out/bin" "$out/share/man/man1"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Interactive ASCII name and synonym chart";
+    homepage = "http://www.catb.org/~esr/ascii/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/bcat/Gemfile b/nixpkgs/pkgs/tools/text/bcat/Gemfile
new file mode 100644
index 000000000000..a25a2e890978
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/bcat/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'bcat'
diff --git a/nixpkgs/pkgs/tools/text/bcat/Gemfile.lock b/nixpkgs/pkgs/tools/text/bcat/Gemfile.lock
new file mode 100644
index 000000000000..cbff494fe867
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/bcat/Gemfile.lock
@@ -0,0 +1,15 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    bcat (0.6.2)
+      rack (~> 1.0)
+    rack (1.6.11)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  bcat
+
+BUNDLED WITH
+   2.1.4
diff --git a/nixpkgs/pkgs/tools/text/bcat/default.nix b/nixpkgs/pkgs/tools/text/bcat/default.nix
new file mode 100644
index 000000000000..dffd58de44fe
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/bcat/default.nix
@@ -0,0 +1,17 @@
+{ lib, bundlerApp, bundlerUpdateScript }:
+
+bundlerApp {
+  pname = "bcat";
+  gemdir = ./.;
+  exes = [ "bcat" "btee" "a2h" ];
+
+  passthru.updateScript = bundlerUpdateScript "bcat";
+
+  meta = with lib; {
+    description = "Pipe to browser utility";
+    homepage    = "http://rtomayko.github.com/bcat/";
+    license     = licenses.mit;
+    maintainers = with maintainers; [ jraygauthier nicknovitski ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/bcat/gemset.nix b/nixpkgs/pkgs/tools/text/bcat/gemset.nix
new file mode 100644
index 000000000000..75de0e5cf38a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/bcat/gemset.nix
@@ -0,0 +1,23 @@
+{
+  bcat = {
+    dependencies = ["rack"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0w2wwlngcs7f4lmvifixrb89bjkw2lx8z0nn72w360hz394ic651";
+      type = "gem";
+    };
+    version = "0.6.2";
+  };
+  rack = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1g9926ln2lw12lfxm4ylq1h6nl0rafl10za3xvjzc87qvnqic87f";
+      type = "gem";
+    };
+    version = "1.6.11";
+  };
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/tools/text/boxes/default.nix b/nixpkgs/pkgs/tools/text/boxes/default.nix
new file mode 100644
index 000000000000..b9d54d3a9e77
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/boxes/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, bison, flex }:
+
+stdenv.mkDerivation rec {
+  pname = "boxes";
+  version = "1.3";
+
+  src = fetchFromGitHub {
+    owner = "ascii-boxes";
+    repo = "boxes";
+    rev = "v${version}";
+    sha256 = "0b12rsynrmkldlwcb62drk33kk0aqwbj10mq5y5x3hjf626gjwsi";
+  };
+
+  # Building instructions:
+  # https://boxes.thomasjensen.com/build.html#building-on-linux--unix
+  nativeBuildInputs = [ bison flex ];
+
+  dontConfigure = true;
+
+  # Makefile references a system wide config file in '/usr/share'. Instead, we
+  # move it within the store by default.
+  preBuild = ''
+    substituteInPlace Makefile \
+      --replace "GLOBALCONF = /usr/share/boxes" \
+                "GLOBALCONF=${placeholder "out"}/share/boxes/boxes-config"
+  '';
+
+  makeFlags = stdenv.lib.optionals stdenv.isDarwin [ "CC=cc" ];
+
+  installPhase = ''
+    install -Dm755 -t $out/bin src/boxes
+    install -Dm644 -t $out/share/boxes boxes-config
+    install -Dm644 -t $out/share/man/man1 doc/boxes.1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Command line ASCII boxes unlimited!";
+    longDescription = ''
+      Boxes is a command line filter program that draws ASCII art boxes around
+      your input text.
+    '';
+    homepage = "https://boxes.thomasjensen.com";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ waiting-for-dev ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/catdoc/default.nix b/nixpkgs/pkgs/tools/text/catdoc/default.nix
new file mode 100644
index 000000000000..64ef092f36be
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/catdoc/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  pname = "catdoc";
+  version = "0.95";
+
+  src = fetchurl {
+    url = "http://ftp.wagner.pp.ru/pub/catdoc/${pname}-${version}.tar.gz";
+    sha256 = "514a84180352b6bf367c1d2499819dfa82b60d8c45777432fa643a5ed7d80796";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/c/catdoc/1:0.95-4.1/debian/patches/05-CVE-2017-11110.patch";
+      sha256 = "1ljnwvssvzig94hwx8843b88p252ww2lbxh8zybcwr3kwwlcymx7";
+    })
+  ];
+
+  configureFlags = [ "--disable-wordview" ];
+
+  meta = with stdenv.lib; {
+    description = "MS-Word/Excel/PowerPoint to text converter";
+    platforms = platforms.all;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/catdocx/default.nix b/nixpkgs/pkgs/tools/text/catdocx/default.nix
new file mode 100644
index 000000000000..f24864f754b3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/catdocx/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper, unzip, catdoc }:
+
+stdenv.mkDerivation {
+  name = "catdocx-20170102";
+
+  src = fetchFromGitHub {
+    owner = "jncraton";
+    repo = "catdocx";
+    rev = "04fa0416ec1f116d4996685e219f0856d99767cb";
+    sha256 = "1sxiqhkvdqn300ygfgxdry2dj2cqzjhkzw13c6349gg5vxfypcjh";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/libexec $out/bin
+    cp catdocx.sh $out/libexec
+    chmod +x $out/libexec/catdocx.sh
+    wrapProgram $out/libexec/catdocx.sh --prefix PATH : "${lib.makeBinPath [ unzip catdoc ]}"
+    ln -s $out/libexec/catdocx.sh $out/bin/catdocx
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Extracts plain text from docx files";
+    homepage = "https://github.com/jncraton/catdocx";
+    license = with licenses; [ bsd3 ];
+    maintainers = [ maintainers.michalrus ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/cconv/default.nix b/nixpkgs/pkgs/tools/text/cconv/default.nix
new file mode 100644
index 000000000000..8fe400aaab25
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/cconv/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, autoreconfHook }:
+let version = "0.6.3"; in
+  stdenv.mkDerivation {
+  pname = "cconv";
+  inherit version;
+  
+  src = fetchurl {
+    url = "https://github.com/xiaoyjy/cconv/archive/v${version}.tar.gz";
+    sha256 = "82f46a94829f5a8157d6f686e302ff5710108931973e133d6e19593061b81d84";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  
+  meta = with stdenv.lib; {
+    description = "A iconv based simplified-traditional chinese conversion tool";
+    homepage = "https://github.com/xiaoyjy/cconv";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.redfish64 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/codesearch/default.nix b/nixpkgs/pkgs/tools/text/codesearch/default.nix
new file mode 100644
index 000000000000..7f706cf13765
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/codesearch/default.nix
@@ -0,0 +1,26 @@
+# This file was generated by go2nix.
+{ stdenv, buildGoPackage, fetchgit }:
+
+buildGoPackage rec {
+  pname = "codesearch";
+  version = "20150717-${stdenv.lib.strings.substring 0 7 rev}";
+  rev = "a45d81b686e85d01f2838439deaf72126ccd5a96";
+
+  goPackagePath = "github.com/google/codesearch";
+
+  src = fetchgit {
+    inherit rev;
+    url = "https://github.com/google/codesearch";
+    sha256 = "12bv3yz0l3bmsxbasfgv7scm9j719ch6pmlspv4bd4ix7wjpyhny";
+  };
+
+  goDeps = ./deps.nix;
+
+  meta = {
+    description = "Fast, indexed regexp search over large file trees";
+    homepage = "https://github.com/google/codesearch";
+    license = [ stdenv.lib.licenses.bsd3 ];
+    maintainers = [ stdenv.lib.maintainers.bennofs ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/codesearch/deps.nix b/nixpkgs/pkgs/tools/text/codesearch/deps.nix
new file mode 100644
index 000000000000..2d1dad706340
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/codesearch/deps.nix
@@ -0,0 +1,3 @@
+# This file was generated by go2nix.
+[
+]
diff --git a/nixpkgs/pkgs/tools/text/colordiff/default.nix b/nixpkgs/pkgs/tools/text/colordiff/default.nix
new file mode 100644
index 000000000000..1ba1db1f7cb5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/colordiff/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, perl /*, xmlto */}:
+
+stdenv.mkDerivation rec {
+  name = "colordiff-1.0.18";
+
+  src = fetchurl {
+    urls = [
+      "https://www.colordiff.org/${name}.tar.gz"
+      "http://www.colordiff.org/archive/${name}.tar.gz"
+    ];
+    sha256 = "1q6n60n4b9fnzccxyxv04mxjsql4ddq17vl2c74ijvjdhpcfrkr9";
+  };
+
+  buildInputs = [ perl /* xmlto */ ];
+
+  dontBuild = 1; # do not build doc yet.
+
+  installPhase = ''make INSTALL_DIR=/bin MAN_DIR=/share/man/man1 DESTDIR="$out" install'';
+
+  meta = with stdenv.lib; {
+    description = "Wrapper for 'diff' that produces the same output but with pretty 'syntax' highlighting";
+    homepage = "https://www.colordiff.org/";
+    license = licenses.gpl3;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/coloursum/default.nix b/nixpkgs/pkgs/tools/text/coloursum/default.nix
new file mode 100644
index 000000000000..f38ada46c119
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/coloursum/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, rustPlatform, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "coloursum";
+  version = "0.2.0";
+
+  src = fetchFromGitHub {
+    owner = "ticky";
+    repo = "coloursum";
+    rev = "v${version}";
+    sha256 = "1piz0l7qdcvjzfykm6rzqc8s1daxp3cj3923v9cmm41bc2v0p5q0";
+  };
+
+  cargoSha256 = "1w0q5w0bf1682jvzcml8cgmr9mrgi4if0p63wzchyjav330dp6pk";
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  meta = with stdenv.lib; {
+    description = "Colourise your checksum output";
+    homepage = "https://github.com/ticky/coloursum";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ fgaz ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/convertlit/default.nix b/nixpkgs/pkgs/tools/text/convertlit/default.nix
new file mode 100644
index 000000000000..a947ef98a689
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/convertlit/default.nix
@@ -0,0 +1,36 @@
+{stdenv, fetchzip, libtommath}:
+
+stdenv.mkDerivation {
+  name = "convertlit-1.8";
+
+  src = fetchzip {
+    url = "http://www.convertlit.com/convertlit18src.zip";
+    sha256 = "182nsin7qscgbw2h92m0zadh3h8q410h5cza6v486yjfvla3dxjx";
+    stripRoot = false;
+  };
+
+  buildInputs = [libtommath];
+
+  hardeningDisable = [ "format" ];
+
+  buildPhase = ''
+    cd lib
+    make
+    cd ../clit18
+    substituteInPlace Makefile \
+      --replace ../libtommath-0.30/libtommath.a -ltommath
+    make
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp clit $out/bin
+  '';
+
+  meta = {
+    homepage = "http://www.convertlit.com/";
+    description = "A tool for converting Microsoft Reader ebooks to more open formats";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/copyright-update/default.nix b/nixpkgs/pkgs/tools/text/copyright-update/default.nix
new file mode 100644
index 000000000000..ca815f915db3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/copyright-update/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, perl }:
+
+stdenv.mkDerivation rec {
+  pname = "copyright-update";
+  version = "2016.1018";
+
+  src = fetchFromGitHub {
+    name = "${pname}-${version}-src";
+    owner = "jaalto";
+    repo = "project--copyright-update";
+    rev = "release/${version}";
+    sha256 = "1kj6jlgyxrgvrpv7fcgbibfqqa83xljp17v6sas42dlb105h6sgd";
+  };
+
+  buildInputs = [ perl ];
+
+  installFlags = [ "INSTALL=install" "prefix=$(out)" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/jaalto/project--copyright-update";
+    description = "Updates the copyright information in a set of files";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.rycee ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/csvkit/default.nix b/nixpkgs/pkgs/tools/text/csvkit/default.nix
new file mode 100644
index 000000000000..7a0240fc7301
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/csvkit/default.nix
@@ -0,0 +1,41 @@
+{ lib, python3, glibcLocales }:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "csvkit";
+  version = "1.0.4";
+
+  src = python3.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "1830lb95rh1iyi3drlwxzb6y3pqkii0qiyzd40c1kvhvaf1s6lqk";
+  };
+
+  propagatedBuildInputs = with python3.pkgs; [
+    agate
+    agate-excel
+    agate-dbf
+    # sql test fail with agate-sql-0.5.4
+    (agate-sql.overridePythonAttrs(old: rec {
+      version = "0.5.3";
+      src = python3.pkgs.fetchPypi {
+        inherit (old) pname;
+        inherit version;
+        sha256 = "1d6rbahmdix7xi7ma2v86fpk5yi32q5dba5vama35w5mmn2pnyw7";
+      };}))
+    six
+  ];
+
+  checkInputs = with python3.pkgs; [
+    glibcLocales nose
+  ];
+
+  checkPhase = ''
+    LC_ALL="en_US.UTF-8" nosetests -e test_csvsql
+  '';
+
+  meta = with lib; {
+    description = "A suite of command-line tools for converting to and working with CSV";
+    maintainers = with maintainers; [ vrthra ];
+    license = licenses.mit;
+    homepage = "https://github.com/wireservice/csvkit";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/dadadodo/default.nix b/nixpkgs/pkgs/tools/text/dadadodo/default.nix
new file mode 100644
index 000000000000..5de8e25e6fb2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/dadadodo/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "dadadodo";
+  version = "1.04";
+
+  src = fetchurl {
+    url = "https://www.jwz.org/dadadodo/${pname}-${version}.tar.gz";
+    sha256 = "1pzwp3mim58afjrc92yx65mmgr1c834s1v6z4f4gyihwjn8bn3if";
+  };
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp dadadodo $out/bin
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    description = "Markov chain-based text generator";
+    homepage = "http://www.jwz.org/dadadodo";
+    maintainers = with maintainers; [ pSub ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/diction/default.nix b/nixpkgs/pkgs/tools/text/diction/default.nix
new file mode 100644
index 000000000000..f43cd94a83e7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/diction/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "diction";
+  version = "1.13";
+
+  src = fetchurl {
+    url = "http://www.moria.de/~michael/diction/${pname}-${version}.tar.gz";
+    sha256 = "08fi971b8qa4xycxbgb42i6b5ms3qx9zpp5hwpbxy2vypfs0wph9";
+  };
+
+  meta = {
+    description = "GNU style and diction utilities";
+    longDescription = ''
+      Diction and style are two old standard Unix commands. Diction identifies
+      wordy and commonly misused phrases. Style analyses surface
+      characteristics of a document, including sentence length and other
+      readability measures.
+    '';
+    license = stdenv.lib.licenses.gpl3Plus;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/diffr/default.nix b/nixpkgs/pkgs/tools/text/diffr/default.nix
new file mode 100644
index 000000000000..016cc40977b2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/diffr/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, rustPlatform, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "diffr";
+  version = "v0.1.4";
+
+  src = fetchFromGitHub {
+    owner = "mookid";
+    repo = pname;
+    rev = version;
+    sha256 = "18ks5g4bx6iz9hdjxmi6a41ncxpb1hnsscdlddp2gr40k3vgd0pa";
+  };
+
+  cargoSha256 = "09yn02985yv40n9y0ipz0jmj7iqhz7l8hd3ry9ib3fyw9pyklnfa";
+
+  buildInputs = (stdenv.lib.optional stdenv.isDarwin Security);
+
+  preCheck = ''
+    export DIFFR_TESTS_BINARY_PATH=$releaseDir/diffr
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Yet another diff highlighting tool";
+    homepage = "https://github.com/mookid/diffr";
+    license = with licenses; [ mit ];
+    maintainers = with maintainers; [ davidtwco ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/diffstat/default.nix b/nixpkgs/pkgs/tools/text/diffstat/default.nix
new file mode 100644
index 000000000000..bed34e30e790
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/diffstat/default.nix
@@ -0,0 +1,26 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "diffstat-1.63";
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.invisible-island.net/diffstat/${name}.tgz"
+      "https://invisible-mirror.net/archives/diffstat/${name}.tgz"
+    ];
+    sha256 = "0vyw200s5dv1257pmrh6c6fdkmw3slyz5szpqfx916xr04sdbpby";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Read output of diff and display a histogram of the changes";
+    longDescription = ''
+      diffstat reads the output of diff and displays a histogram of the
+      insertions, deletions, and modifications per-file. It is useful for
+      reviewing large, complex patch files.
+    '';
+    homepage = "https://invisible-island.net/diffstat/";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/diffutils/default.nix b/nixpkgs/pkgs/tools/text/diffutils/default.nix
new file mode 100644
index 000000000000..06ecda9ff21d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/diffutils/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, xz, coreutils ? null }:
+
+stdenv.mkDerivation rec {
+  name = "diffutils-3.7";
+
+  src = fetchurl {
+    url = "mirror://gnu/diffutils/${name}.tar.xz";
+    sha256 = "09isrg0isjinv8c535nxsi1s86wfdfzml80dbw41dj9x3hiad9xk";
+  };
+
+  outputs = [ "out" "info" ];
+
+  nativeBuildInputs = [ xz.bin ];
+  /* If no explicit coreutils is given, use the one from stdenv. */
+  buildInputs = [ coreutils ];
+
+  configureFlags =
+    # "pr" need not be on the PATH as a run-time dep, so we need to tell
+    # configure where it is. Covers the cross and native case alike.
+    stdenv.lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr"
+    ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "gl_cv_func_getopt_gnu=yes";
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.gnu.org/software/diffutils/diffutils.html";
+    description = "Commands for showing the differences between files (diff, cmp, etc.)";
+    license = licenses.gpl3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/discount/default.nix b/nixpkgs/pkgs/tools/text/discount/default.nix
new file mode 100644
index 000000000000..5a4dfd5de854
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/discount/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  version = "2.2.6";
+  pname = "discount";
+
+  src = fetchFromGitHub {
+    owner = "Orc";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1y066jkxfas0vdixbqq66j9p00a102sbfgq5gbrblfczqjrmc38w";
+  };
+
+  patches = ./fix-configure-path.patch;
+  configureScript = "./configure.sh";
+
+  configureFlags = [
+    "--enable-all-features"
+    "--pkg-config"
+    "--shared"
+    "--with-fenced-code"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Implementation of Markdown markup language in C";
+    homepage = "http://www.pell.portland.or.us/~orc/Code/discount/";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ shell ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/discount/fix-configure-path.patch b/nixpkgs/pkgs/tools/text/discount/fix-configure-path.patch
new file mode 100644
index 000000000000..045b369b4b69
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/discount/fix-configure-path.patch
@@ -0,0 +1,12 @@
+diff -rupN discount-2.1.6-original/configure.inc discount-2.1.6/configure.inc
+--- discount-2.1.6-original/configure.inc	2014-10-10 15:34:24.158325345 +0100
++++ discount-2.1.6/configure.inc	2014-10-10 15:34:33.553325321 +0100
+@@ -32,7 +32,7 @@
+ # this preamble code is executed when this file is sourced and it picks
+ # interesting things off the command line.
+ #
+-ac_default_path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
++ac_default_path=$PATH
+ 
+ ac_standard="--src=DIR		where the source lives (.)
+ --prefix=DIR		where to install the final product (/usr/local)
diff --git a/nixpkgs/pkgs/tools/text/dos2unix/default.nix b/nixpkgs/pkgs/tools/text/dos2unix/default.nix
new file mode 100644
index 000000000000..b7efe02f4cdb
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/dos2unix/default.nix
@@ -0,0 +1,22 @@
+{stdenv, fetchurl, perl, gettext }:
+
+stdenv.mkDerivation rec {
+  pname = "dos2unix";
+  version = "7.4.1";
+
+  src = fetchurl {
+    url = "https://waterlan.home.xs4all.nl/dos2unix/${pname}-${version}.tar.gz";
+    sha256 = "08w6yywzirsxq8bh87jycvvw922ybhc2l426j2iqzliyn1h8mm8w";
+  };
+
+  nativeBuildInputs = [ perl gettext ];
+  makeFlags = [ "prefix=${placeholder "out"}" ];
+
+  meta = with stdenv.lib; {
+    description = "Convert text files with DOS or Mac line breaks to Unix line breaks and vice versa";
+    homepage = "https://waterlan.home.xs4all.nl/dos2unix.html";
+    changelog = "https://sourceforge.net/p/dos2unix/dos2unix/ci/dos2unix-${version}/tree/dos2unix/NEWS.txt?format=raw";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ c0bw3b ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ebook-tools/default.nix b/nixpkgs/pkgs/tools/text/ebook-tools/default.nix
new file mode 100644
index 000000000000..2a6af785692a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ebook-tools/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, cmake, pkgconfig, libxml2, libzip }:
+
+stdenv.mkDerivation rec {
+  name = "ebook-tools-0.2.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/ebook-tools/${name}.tar.gz";
+    sha256 = "1bi7wsz3p5slb43kj7lgb3r6lb91lvb6ldi556k4y50ix6b5khyb";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake libxml2 libzip ];
+
+  preConfigure = 
+    ''
+      NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libzip)"
+    '';
+
+  meta = {
+    homepage = "http://ebook-tools.sourceforge.net";
+    description = "Tools and library for dealing with various ebook file formats";
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/enca/default.nix b/nixpkgs/pkgs/tools/text/enca/default.nix
new file mode 100644
index 000000000000..6cfb4721066c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/enca/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, libiconv, recode }:
+
+stdenv.mkDerivation rec {
+  pname = "enca";
+  version = "1.19";
+
+  src = fetchurl {
+    url = "https://dl.cihar.com/enca/${pname}-${version}.tar.xz";
+    sha256 = "1f78jmrggv3jymql8imm5m9yc8nqjw5l99mpwki2245l8357wj1s";
+  };
+
+  buildInputs = [ recode libiconv ];
+
+  meta = with stdenv.lib; {
+    description = "Detects the encoding of text files and reencodes them";
+
+    longDescription = ''
+        Enca detects the encoding of text files, on the basis of knowledge
+        of their language. It can also convert them to other encodings,
+        allowing you to recode files without knowing their current encoding.
+        It supports most of Central and East European languages, and a few
+        Unicode variants, independently on language.
+    '';
+
+    license = licenses.gpl2;
+   
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/enscript/default.nix b/nixpkgs/pkgs/tools/text/enscript/default.nix
new file mode 100644
index 000000000000..670e052772ef
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/enscript/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, gettext }:
+
+stdenv.mkDerivation rec {
+  name = "enscript-1.6.6";
+
+  src = fetchurl {
+    url = "mirror://gnu/enscript/${name}.tar.gz";
+    sha256 = "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd";
+  };
+
+  preBuild =
+    ''
+      # Fix building on Darwin with GCC.
+      substituteInPlace compat/regex.c --replace \
+         __private_extern__  '__attribute__ ((visibility ("hidden")))'
+    '';
+
+  buildInputs = [ gettext ];
+
+  doCheck = true;
+
+  meta = {
+    description = "Converter from ASCII to PostScript, HTML, or RTF";
+
+    longDescription =
+      '' GNU Enscript converts ASCII files to PostScript, HTML, or RTF and
+         stores generated output to a file or sends it directly to the
+         printer.  It includes features for `pretty-printing'
+         (language-sensitive code highlighting) in several programming
+         languages.
+
+         Enscript can be easily extended to handle different output media and
+         it has many options that can be used to customize printouts.
+      '';
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    homepage = "https://www.gnu.org/software/enscript/";
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/epubcheck/default.nix b/nixpkgs/pkgs/tools/text/epubcheck/default.nix
new file mode 100644
index 000000000000..914fe0067355
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/epubcheck/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchzip
+, jre, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "epubcheck";
+  version = "4.2.2";
+
+  src = fetchzip {
+    url = "https://github.com/w3c/epubcheck/releases/download/v${version}/epubcheck-${version}.zip";
+    sha256 = "0vz7k6i6y60ml20pbw2p9iqy6kxw4ziqszg6hbgz102x1jk8788d";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp -r lib/* $out/lib
+
+    mkdir -p $out/libexec/epubcheck
+    cp epubcheck.jar $out/libexec/epubcheck
+
+    classpath=$out/libexec/epubcheck/epubcheck.jar
+    for jar in $out/lib/*.jar; do
+      classpath="$classpath:$jar"
+    done
+
+    mkdir -p $out/bin
+    makeWrapper ${jre}/bin/java $out/bin/epubcheck \
+      --add-flags "-classpath $classpath com.adobe.epubcheck.tool.Checker"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/w3c/epubcheck";
+    description = "Validation tool for EPUB";
+    license = with licenses; [ asl20 bsd3 mpl10 w3c ];
+    platforms = platforms.all;
+    maintainers = with maintainers; [ eadwu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/esh/default.nix b/nixpkgs/pkgs/tools/text/esh/default.nix
new file mode 100644
index 000000000000..171d90026be8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/esh/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, asciidoctor, gawk, gnused, runtimeShell }:
+
+stdenv.mkDerivation rec {
+  pname = "esh";
+  version = "0.1.1";
+
+  src = fetchFromGitHub {
+    owner = "jirutka";
+    repo = "esh";
+    rev = "v${version}";
+    sha256 = "1ddaji5nplf1dyvgkrhqjy8m5djaycqcfhjv30yprj1avjymlj6w";
+  };
+
+  nativeBuildInputs = [ asciidoctor ];
+
+  buildInputs = [ gawk gnused ];
+
+  makeFlags = [ "prefix=$(out)" "DESTDIR=" ];
+
+  postPatch = ''
+    patchShebangs .
+    substituteInPlace esh \
+        --replace '"/bin/sh"' '"${runtimeShell}"' \
+        --replace '"awk"' '"${gawk}/bin/awk"' \
+        --replace 'sed' '${gnused}/bin/sed'
+    substituteInPlace tests/test-dump.exp \
+        --replace '#!/bin/sh' '#!${runtimeShell}'
+  '';
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = with stdenv.lib; {
+    description = "Simple templating engine based on shell";
+    homepage = "https://github.com/jirutka/esh";
+    license = licenses.mit;
+    maintainers = with maintainers; [ mnacamura ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/fanficfare/default.nix b/nixpkgs/pkgs/tools/text/fanficfare/default.nix
new file mode 100644
index 000000000000..ac90b4d7792c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/fanficfare/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "FanFicFare";
+  version = "3.17.0";
+
+  src = python3Packages.fetchPypi {
+    inherit pname version;
+    sha256 = "1h7kzlw516w9qk5vcn0rqibxbhvzbmxgnf9l6yjxj30x53ynrvzj";
+  };
+
+  propagatedBuildInputs = with python3Packages; [
+    beautifulsoup4
+    chardet
+    html5lib
+    html2text
+  ];
+
+  doCheck = false; # no tests exist
+
+  meta = with stdenv.lib; {
+    description = "Tool for making eBooks from fanfiction web sites";
+    homepage = "https://github.com/JimmXinu/FanFicFare";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ dwarfmaster ];
+    inherit version;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/gawk/default.nix b/nixpkgs/pkgs/tools/text/gawk/default.nix
new file mode 100644
index 000000000000..58dea610c392
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gawk/default.nix
@@ -0,0 +1,84 @@
+{ stdenv, fetchurl
+# TODO: links -lsigsegv but loses the reference for some reason
+, withSigsegv ? (false && stdenv.hostPlatform.system != "x86_64-cygwin"), libsigsegv
+, interactive ? false, readline
+
+/* Test suite broke on:
+       stdenv.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1
+    || stdenv.isDarwin # XXX: `locale' segfaults
+    || stdenv.isSunOS  # XXX: `_backsmalls1' fails, locale stuff?
+    || stdenv.isFreeBSD
+*/
+, doCheck ? (interactive && stdenv.isLinux), glibcLocales ? null
+, locale ? null
+}:
+
+assert (doCheck && stdenv.isLinux) -> glibcLocales != null;
+
+let
+  inherit (stdenv.lib) optional;
+in
+stdenv.mkDerivation rec {
+  name = "gawk-5.0.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/gawk/${name}.tar.xz";
+    sha256 = "15570p7g2x54asvr2fsc56sxzmm08fbk4mzpcs5n92fp9vq8cklf";
+  };
+
+  # When we do build separate interactive version, it makes sense to always include man.
+  outputs = [ "out" "info" ] ++ optional (!interactive) "man";
+
+  nativeBuildInputs = optional (doCheck && stdenv.isLinux) glibcLocales;
+
+  buildInputs =
+       optional withSigsegv libsigsegv
+    ++ optional interactive readline
+    ++ optional stdenv.isDarwin locale;
+
+  configureFlags = [
+    (if withSigsegv then "--with-libsigsegv-prefix=${libsigsegv}" else "--without-libsigsegv")
+    (if interactive then "--with-readline=${readline.dev}" else "--without-readline")
+  ];
+
+  makeFlags = [
+    "AR=${stdenv.cc.targetPrefix}ar"
+  ];
+
+  inherit doCheck;
+
+  postInstall = ''
+    rm "$out"/bin/gawk-*
+    ln -s gawk.1 "''${!outputMan}"/share/man/man1/awk.1
+  '';
+
+  passthru = {
+    libsigsegv = if withSigsegv then libsigsegv else null; # for stdenv bootstrap
+  };
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.gnu.org/software/gawk/";
+    description = "GNU implementation of the Awk programming language";
+
+    longDescription = ''
+      Many computer users need to manipulate text files: extract and then
+      operate on data from parts of certain lines while discarding the rest,
+      make changes in various text files wherever certain patterns appear,
+      and so on.  To write a program to do these things in a language such as
+      C or Pascal is a time-consuming inconvenience that may take many lines
+      of code.  The job is easy with awk, especially the GNU implementation:
+      Gawk.
+
+      The awk utility interprets a special-purpose programming language that
+      makes it possible to handle many data-reformatting jobs with just a few
+      lines of code.
+    '';
+
+    license = licenses.gpl3Plus;
+
+    platforms = platforms.unix ++ platforms.windows;
+
+    maintainers = [ ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/tools/text/gawk/gawk-with-extensions.nix b/nixpkgs/pkgs/tools/text/gawk/gawk-with-extensions.nix
new file mode 100644
index 000000000000..751e5181bb58
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gawk/gawk-with-extensions.nix
@@ -0,0 +1,12 @@
+{ runCommand, gawk, extensions, makeWrapper }:
+
+runCommand "gawk-with-extensions" {
+  buildInputs = [ makeWrapper gawk ] ++ extensions;
+} ''
+  mkdir -p $out/bin
+  for i in ${gawk}/bin/*; do
+    name="$(basename "$i")"
+    makeWrapper $i $out/bin/$name \
+      --prefix AWKLIBPATH : "${gawk}/lib/gawk:''${AWKLIBPATH:-}"
+  done
+''
diff --git a/nixpkgs/pkgs/tools/text/gawk/gawkextlib.nix b/nixpkgs/pkgs/tools/text/gawk/gawkextlib.nix
new file mode 100644
index 000000000000..e15b2d4e257d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gawk/gawkextlib.nix
@@ -0,0 +1,149 @@
+{ stdenv, recurseIntoAttrs, fetchgit, writeText, pkgconfig, autoreconfHook
+, autoconf, automake, libiconv, libtool, texinfo, gettext, gawk, rapidjson, gd
+, shapelib, libharu, lmdb, gmp, glibcLocales, mpfr, more, postgresql, hiredis
+, expat, tre, makeWrapper }:
+
+let
+  buildExtension = stdenv.lib.makeOverridable
+    ({ name, gawkextlib, extraBuildInputs ? [ ], doCheck ? true }:
+      let is_extension = !isNull gawkextlib;
+      in stdenv.mkDerivation rec {
+        pname = "gawkextlib-${name}";
+        version = "unstable-2019-11-21";
+
+        src = fetchgit {
+          url = "git://git.code.sf.net/p/gawkextlib/code";
+          rev = "f70f10da2804e4fd0a0bac57736e9c1cf21e345d";
+          sha256 = "0r8fz89n3l4dfszs1980yqj0ah95430lj0y1lb7blfkwxa6c2xik";
+        };
+
+        postPatch = ''
+          cd ${name}
+        '';
+
+        nativeBuildInputs = [
+          autoconf
+          automake
+          libtool
+          autoreconfHook
+          pkgconfig
+          texinfo
+          gettext
+        ];
+
+        buildInputs = [ gawk ] ++ extraBuildInputs;
+        propagatedBuildInputs = stdenv.lib.optional is_extension gawkextlib;
+
+        setupHook = if is_extension then ./setup-hook.sh else null;
+        inherit gawk;
+
+        inherit doCheck;
+        checkInputs = [ more ];
+
+        meta = with stdenv.lib; {
+          homepage = "https://sourceforge.net/projects/gawkextlib/";
+          description = "Dynamically loaded extension libraries for GNU AWK";
+          longDescription = ''
+            The gawkextlib project provides several extension libraries for
+            gawk (GNU AWK), as well as libgawkextlib containing some APIs that
+            are useful for building gawk extension libraries. These libraries
+            enable gawk to process XML data, interact with a PostgreSQL
+            database, use the GD graphics library, and perform unlimited
+            precision MPFR calculations.
+          '';
+          license = licenses.gpl3Plus;
+          platforms = platforms.unix;
+          maintainers = with maintainers; [ tomberek ];
+        };
+      });
+  gawkextlib = buildExtension {
+    gawkextlib = null;
+    name = "lib";
+  };
+  libs = {
+    abort = buildExtension {
+      inherit gawkextlib;
+      name = "abort";
+    };
+    aregex = buildExtension {
+      inherit gawkextlib;
+      name = "aregex";
+      extraBuildInputs = [ tre ];
+    };
+    csv = buildExtension {
+      inherit gawkextlib;
+      name = "csv";
+    };
+    errno = buildExtension {
+      inherit gawkextlib;
+      name = "errno";
+    };
+    gd = buildExtension {
+      inherit gawkextlib;
+      name = "gd";
+      extraBuildInputs = [ gd ];
+    };
+    haru = buildExtension {
+      inherit gawkextlib;
+      name = "haru";
+      extraBuildInputs = [ libharu ];
+    };
+    json = buildExtension {
+      inherit gawkextlib;
+      name = "json";
+      extraBuildInputs = [ rapidjson ];
+    };
+    lmdb = buildExtension {
+      inherit gawkextlib;
+      name = "lmdb";
+      extraBuildInputs = [ lmdb ];
+      #  mdb_env_open(env, /dev/null)
+      #! No such device
+      #  mdb_env_open(env, /dev/null)
+      #! Operation not supported by device
+      doCheck = !stdenv.isDarwin;
+    };
+    mbs = buildExtension {
+      inherit gawkextlib;
+      name = "mbs";
+      extraBuildInputs = [ glibcLocales ];
+      #! "spät": length: 5, mbs_length: 6, wcswidth: 4
+      doCheck = !stdenv.isDarwin;
+    };
+    mpfr = buildExtension {
+      inherit gawkextlib;
+      name = "mpfr";
+      extraBuildInputs = [ gmp mpfr ];
+    };
+    nl_langinfo = buildExtension {
+      inherit gawkextlib;
+      name = "nl_langinfo";
+    };
+    pgsql = buildExtension {
+      inherit gawkextlib;
+      name = "pgsql";
+      extraBuildInputs = [ postgresql ];
+    };
+    redis = buildExtension {
+      inherit gawkextlib;
+      name = "redis";
+      extraBuildInputs = [ hiredis ];
+    };
+    select = buildExtension {
+      inherit gawkextlib;
+      name = "select";
+    };
+    timex = buildExtension {
+      inherit gawkextlib;
+      name = "timex";
+    };
+    xml = buildExtension {
+      inherit gawkextlib;
+      name = "xml";
+      extraBuildInputs = [ expat libiconv ];
+    };
+  };
+in recurseIntoAttrs (libs // {
+  inherit gawkextlib buildExtension;
+  full = builtins.attrValues libs;
+})
diff --git a/nixpkgs/pkgs/tools/text/gawk/setup-hook.sh b/nixpkgs/pkgs/tools/text/gawk/setup-hook.sh
new file mode 100644
index 000000000000..d568cb8c7dd9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gawk/setup-hook.sh
@@ -0,0 +1,6 @@
+local oldOpts="-u"
+shopt -qo nounset || oldOpts="+u"
+set +u
+. @gawk@/etc/profile.d/gawk.sh
+gawklibpath_append @out@/lib/gawk
+set "$oldOpts"
diff --git a/nixpkgs/pkgs/tools/text/gist/default.nix b/nixpkgs/pkgs/tools/text/gist/default.nix
new file mode 100644
index 000000000000..a4a26e139fb2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gist/default.nix
@@ -0,0 +1,17 @@
+{ buildRubyGem, lib, ruby }:
+
+buildRubyGem rec {
+  inherit ruby;
+  name = "${gemName}-${version}";
+  gemName = "gist";
+  version = "5.1.0";
+  source.sha256 = "0s69y6hi5iq5k6317j1kjmhi3mk586j1543q8wa608grwcmbq3fw";
+
+  meta = with lib; {
+    description = "Upload code to https://gist.github.com (or github enterprise)";
+    homepage = "http://defunkt.io/gist/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ zimbatm ];
+    platforms = ruby.meta.platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/glogg/default.nix b/nixpkgs/pkgs/tools/text/glogg/default.nix
new file mode 100644
index 000000000000..9dec057dfe9f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/glogg/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, qmake, boost }:
+
+stdenv.mkDerivation rec {
+
+  pname = "glogg";
+  version = "1.1.4";
+
+  src = fetchurl {
+    url = "https://glogg.bonnefon.org/files/${pname}-${version}.tar.gz";
+    sha256 = "0nwnfk9bcz2k7rf08w2cb6qipzdhwmxznik44jxmn9gwxdrdq78c";
+  };
+
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ boost ];
+
+  qmakeFlags = [ "glogg.pro" ];
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "The fast, smart log explorer";
+    longDescription = ''
+      A multi-platform GUI application to browse and search through long or complex log files. It is designed with programmers and system administrators in mind. glogg can be seen as a graphical, interactive combination of grep and less.
+    '';
+    homepage = "https://glogg.bonnefon.org/";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ c0bw3b ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/gnugrep/default.nix b/nixpkgs/pkgs/tools/text/gnugrep/default.nix
new file mode 100644
index 000000000000..3f5c4d7d86cf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnugrep/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, pcre, libiconv, perl }:
+
+let version = "3.4"; in
+
+stdenv.mkDerivation {
+  pname = "gnugrep";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://gnu/grep/grep-${version}.tar.xz";
+    sha256 = "1yy33kiwrxrwj2nxa4fg15bvmwyghqbs8qwkdvy5phm784f7brjq";
+  };
+
+  # Perl is needed for testing
+  nativeBuildInputs = [ perl ];
+  outputs = [ "out" "info" ]; # the man pages are rather small
+
+  buildInputs = [ pcre libiconv ];
+
+  # cygwin: FAIL: multibyte-white-space
+  # freebsd: FAIL mb-non-UTF8-performance
+  # all platforms: timing sensitivity in long-pattern-perf 
+  #doCheck = !stdenv.isDarwin && !stdenv.isSunOS && !stdenv.isCygwin && !stdenv.isFreeBSD;
+  doCheck = false;
+
+  # On macOS, force use of mkdir -p, since Grep's fallback
+  # (./install-sh) is broken.
+  preConfigure = ''
+    export MKDIR_P="mkdir -p"
+  '';
+
+  # Fix reference to sh in bootstrap-tools, and invoke grep via
+  # absolute path rather than looking at argv[0].
+  postInstall =
+    ''
+      rm $out/bin/egrep $out/bin/fgrep
+      echo "#! /bin/sh" > $out/bin/egrep
+      echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
+      echo "#! /bin/sh" > $out/bin/fgrep
+      echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
+      chmod +x $out/bin/egrep $out/bin/fgrep
+    '';
+
+  meta = with stdenv.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;
+
+    maintainers = [ maintainers.eelco ];
+    platforms = platforms.all;
+  };
+
+  passthru = {inherit pcre;};
+}
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/Allow_input_files_to_be_missing_for_ed-style_patches.patch b/nixpkgs/pkgs/tools/text/gnupatch/Allow_input_files_to_be_missing_for_ed-style_patches.patch
new file mode 100644
index 000000000000..98c9aa877a72
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/Allow_input_files_to_be_missing_for_ed-style_patches.patch
@@ -0,0 +1,33 @@
+From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 11:34:51 +0200
+Subject: Allow input files to be missing for ed-style patches
+
+* src/pch.c (do_ed_script): Allow input files to be missing so that new
+files will be created as with non-ed-style patches.
+---
+ src/pch.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index bc6278c..0c5cc26 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname,
+ 
+     if (! dry_run && ! skip_rest_of_patch) {
+ 	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+-	assert (! inerrno);
+-	*outname_needs_removal = true;
+-	copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++	if (inerrno != ENOENT)
++	  {
++	    *outname_needs_removal = true;
++	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++	  }
+ 	sprintf (buf, "%s %s%s", editor_program,
+ 		 verbosity == VERBOSE ? "" : "- ",
+ 		 outname);
+-- 
+cgit v1.0-41-gc330
+
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-1000156.patch b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-1000156.patch
new file mode 100644
index 000000000000..36f33dea2b90
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-1000156.patch
@@ -0,0 +1,211 @@
+From 123eaff0d5d1aebe128295959435b9ca5909c26d Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 12:14:49 +0200
+Subject: Fix arbitrary command execution in ed-style patches
+ (CVE-2018-1000156)
+
+* src/pch.c (do_ed_script): Write ed script to a temporary file instead
+of piping it to ed: this will cause ed to abort on invalid commands
+instead of rejecting them and carrying on.
+* tests/ed-style: New test case.
+* tests/Makefile.am (TESTS): Add test case.
+---
+ src/pch.c         | 91 ++++++++++++++++++++++++++++++++++++++++---------------
+ tests/Makefile.am |  1 +
+ tests/ed-style    | 41 +++++++++++++++++++++++++
+ 3 files changed, 108 insertions(+), 25 deletions(-)
+ create mode 100644 tests/ed-style
+
+diff --git a/src/pch.c b/src/pch.c
+index 0c5cc26..4fd5a05 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -33,6 +33,7 @@
+ # include <io.h>
+ #endif
+ #include <safe.h>
++#include <sys/wait.h>
+ 
+ #define INITHUNKMAX 125			/* initial dynamic allocation size */
+ 
+@@ -2389,24 +2390,28 @@ do_ed_script (char const *inname, char const *outname,
+     static char const editor_program[] = EDITOR_PROGRAM;
+ 
+     file_offset beginning_of_this_line;
+-    FILE *pipefp = 0;
+     size_t chars_read;
++    FILE *tmpfp = 0;
++    char const *tmpname;
++    int tmpfd;
++    pid_t pid;
++
++    if (! dry_run && ! skip_rest_of_patch)
++      {
++	/* Write ed script to a temporary file.  This causes ed to abort on
++	   invalid commands such as when line numbers or ranges exceed the
++	   number of available lines.  When ed reads from a pipe, it rejects
++	   invalid commands and treats the next line as a new command, which
++	   can lead to arbitrary command execution.  */
++
++	tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
++	if (tmpfd == -1)
++	  pfatal ("Can't create temporary file %s", quotearg (tmpname));
++	tmpfp = fdopen (tmpfd, "w+b");
++	if (! tmpfp)
++	  pfatal ("Can't open stream for file %s", quotearg (tmpname));
++      }
+ 
+-    if (! dry_run && ! skip_rest_of_patch) {
+-	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+-	if (inerrno != ENOENT)
+-	  {
+-	    *outname_needs_removal = true;
+-	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+-	  }
+-	sprintf (buf, "%s %s%s", editor_program,
+-		 verbosity == VERBOSE ? "" : "- ",
+-		 outname);
+-	fflush (stdout);
+-	pipefp = popen(buf, binary_transput ? "wb" : "w");
+-	if (!pipefp)
+-	  pfatal ("Can't open pipe to %s", quotearg (buf));
+-    }
+     for (;;) {
+ 	char ed_command_letter;
+ 	beginning_of_this_line = file_tell (pfp);
+@@ -2417,14 +2422,14 @@ do_ed_script (char const *inname, char const *outname,
+ 	}
+ 	ed_command_letter = get_ed_command_letter (buf);
+ 	if (ed_command_letter) {
+-	    if (pipefp)
+-		if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
++	    if (tmpfp)
++		if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
+ 		    write_fatal ();
+ 	    if (ed_command_letter != 'd' && ed_command_letter != 's') {
+ 	        p_pass_comments_through = true;
+ 		while ((chars_read = get_line ()) != 0) {
+-		    if (pipefp)
+-			if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
++		    if (tmpfp)
++			if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
+ 			    write_fatal ();
+ 		    if (chars_read == 2  &&  strEQ (buf, ".\n"))
+ 			break;
+@@ -2437,13 +2442,49 @@ do_ed_script (char const *inname, char const *outname,
+ 	    break;
+ 	}
+     }
+-    if (!pipefp)
++    if (!tmpfp)
+       return;
+-    if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0
+-	|| fflush (pipefp) != 0)
++    if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0
++	|| fflush (tmpfp) != 0)
+       write_fatal ();
+-    if (pclose (pipefp) != 0)
+-      fatal ("%s FAILED", editor_program);
++
++    if (lseek (tmpfd, 0, SEEK_SET) == -1)
++      pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
++
++    if (! dry_run && ! skip_rest_of_patch) {
++	int exclusive = *outname_needs_removal ? 0 : O_EXCL;
++	*outname_needs_removal = true;
++	if (inerrno != ENOENT)
++	  {
++	    *outname_needs_removal = true;
++	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++	  }
++	sprintf (buf, "%s %s%s", editor_program,
++		 verbosity == VERBOSE ? "" : "- ",
++		 outname);
++	fflush (stdout);
++
++	pid = fork();
++	if (pid == -1)
++	  pfatal ("Can't fork");
++	else if (pid == 0)
++	  {
++	    dup2 (tmpfd, 0);
++	    execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
++	    _exit (2);
++	  }
++	else
++	  {
++	    int wstatus;
++	    if (waitpid (pid, &wstatus, 0) == -1
++	        || ! WIFEXITED (wstatus)
++		|| WEXITSTATUS (wstatus) != 0)
++	      fatal ("%s FAILED", editor_program);
++	  }
++    }
++
++    fclose (tmpfp);
++    safe_unlink (tmpname);
+ 
+     if (ofp)
+       {
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 6b6df63..16f8693 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -32,6 +32,7 @@ TESTS = \
+ 	crlf-handling \
+ 	dash-o-append \
+ 	deep-directories \
++	ed-style \
+ 	empty-files \
+ 	false-match \
+ 	fifo \
+diff --git a/tests/ed-style b/tests/ed-style
+new file mode 100644
+index 0000000..d8c0689
+--- /dev/null
++++ b/tests/ed-style
+@@ -0,0 +1,41 @@
++# Copyright (C) 2018 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# in any medium, are permitted without royalty provided the copyright
++# notice and this notice are preserved.
++
++. $srcdir/test-lib.sh
++
++require cat
++use_local_patch
++use_tmpdir
++
++# ==============================================================
++
++cat > ed1.diff <<EOF
++0a
++foo
++.
++EOF
++
++check 'patch -e foo -i ed1.diff' <<EOF
++EOF
++
++check 'cat foo' <<EOF
++foo
++EOF
++
++cat > ed2.diff <<EOF
++1337a
++r !echo bar
++,p
++EOF
++
++check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
++?
++Status: 2
++EOF
++
++check 'cat foo' <<EOF
++foo
++EOF
+-- 
+cgit v1.0-41-gc330
+
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6951.patch b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6951.patch
new file mode 100644
index 000000000000..22d5f061c332
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6951.patch
@@ -0,0 +1,28 @@
+From f290f48a621867084884bfff87f8093c15195e6a Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Mon, 12 Feb 2018 16:48:24 +0100
+Subject: Fix segfault with mangled rename patch
+
+http://savannah.gnu.org/bugs/?53132
+* src/pch.c (intuit_diff_type): Ensure that two filenames are specified
+for renames and copies (fix the existing check).
+---
+ src/pch.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index ff9ed2c..bc6278c 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -974,7 +974,8 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
+     if ((pch_rename () || pch_copy ())
+ 	&& ! inname
+ 	&& ! ((i == OLD || i == NEW) &&
+-	      p_name[! reverse] &&
++	      p_name[reverse] && p_name[! reverse] &&
++	      name_is_valid (p_name[reverse]) &&
+ 	      name_is_valid (p_name[! reverse])))
+       {
+ 	say ("Cannot %s file without two valid file names\n", pch_rename () ? "rename" : "copy");
+-- 
+cgit v1.0-41-gc330
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6952.patch b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6952.patch
new file mode 100644
index 000000000000..2da323c69844
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2018-6952.patch
@@ -0,0 +1,28 @@
+From 9c986353e420ead6e706262bf204d6e03322c300 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 17 Aug 2018 13:35:40 +0200
+Subject: Fix swapping fake lines in pch_swap
+
+* src/pch.c (pch_swap): Fix swapping p_bfake and p_efake when there is a
+blank line in the middle of a context-diff hunk: that empty line stays
+in the middle of the hunk and isn't swapped.
+
+Fixes: https://savannah.gnu.org/bugs/index.php?53133
+---
+ src/pch.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index e92bc64..a500ad9 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2122,7 +2122,7 @@ pch_swap (void)
+     }
+     if (p_efake >= 0) {			/* fix non-freeable ptr range */
+ 	if (p_efake <= i)
+-	    n = p_end - i + 1;
++	    n = p_end - p_ptrn_lines;
+ 	else
+ 	    n = -i;
+ 	p_efake += n;
+-- 
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13636.patch b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13636.patch
new file mode 100644
index 000000000000..e62c3d41753c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13636.patch
@@ -0,0 +1,108 @@
+From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Mon, 15 Jul 2019 16:21:48 +0200
+Subject: Don't follow symlinks unless --follow-symlinks is given
+
+* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
+append_to_file): Unless the --follow-symlinks option is given, open files with
+the O_NOFOLLOW flag to avoid following symlinks.  So far, we were only doing
+that consistently for input files.
+* src/util.c (create_backup): When creating empty backup files, (re)create them
+with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
+---
+ src/inp.c  | 12 ++++++++++--
+ src/util.c | 14 +++++++++++---
+ 2 files changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/src/inp.c b/src/inp.c
+index 32d0919..22d7473 100644
+--- a/src/inp.c
++++ b/src/inp.c
+@@ -238,8 +238,13 @@ plan_a (char const *filename)
+     {
+       if (S_ISREG (instat.st_mode))
+         {
+-	  int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
++	  int flags = O_RDONLY | binary_transput;
+ 	  size_t buffered = 0, n;
++	  int ifd;
++
++	  if (! follow_symlinks)
++	    flags |= O_NOFOLLOW;
++	  ifd = safe_open (filename, flags, 0);
+ 	  if (ifd < 0)
+ 	    pfatal ("can't open file %s", quotearg (filename));
+ 
+@@ -340,6 +345,7 @@ plan_a (char const *filename)
+ static void
+ plan_b (char const *filename)
+ {
++  int flags = O_RDONLY | binary_transput;
+   int ifd;
+   FILE *ifp;
+   int c;
+@@ -353,7 +359,9 @@ plan_b (char const *filename)
+ 
+   if (instat.st_size == 0)
+     filename = NULL_DEVICE;
+-  if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
++  if (! follow_symlinks)
++    flags |= O_NOFOLLOW;
++  if ((ifd = safe_open (filename, flags, 0)) < 0
+       || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
+     pfatal ("Can't open file %s", quotearg (filename));
+   if (TMPINNAME_needs_removal)
+diff --git a/src/util.c b/src/util.c
+index 1cc08ba..fb38307 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
+ 
+ 	  try_makedirs_errno = ENOENT;
+ 	  safe_unlink (bakname);
+-	  while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
++	  while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0)
+ 	    {
+ 	      if (errno != try_makedirs_errno)
+ 		pfatal ("Can't create file %s", quotearg (bakname));
+@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode,
+ static void
+ copy_to_fd (const char *from, int tofd)
+ {
++  int from_flags = O_RDONLY | O_BINARY;
+   int fromfd;
+   ssize_t i;
+ 
+-  if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
++  if (! follow_symlinks)
++    from_flags |= O_NOFOLLOW;
++  if ((fromfd = safe_open (from, from_flags, 0)) < 0)
+     pfatal ("Can't reopen file %s", quotearg (from));
+   while ((i = read (fromfd, buf, bufsize)) != 0)
+     {
+@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost,
+   else
+     {
+       assert (S_ISREG (mode));
++      if (! follow_symlinks)
++	to_flags |= O_NOFOLLOW;
+       tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode,
+ 			  to_dir_known_to_exist);
+       copy_to_fd (from, tofd);
+@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost,
+ void
+ append_to_file (char const *from, char const *to)
+ {
++  int to_flags = O_WRONLY | O_APPEND | O_BINARY;
+   int tofd;
+ 
+-  if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
++  if (! follow_symlinks)
++    to_flags |= O_NOFOLLOW;
++  if ((tofd = safe_open (to, to_flags, 0)) < 0)
+     pfatal ("Can't reopen file %s", quotearg (to));
+   copy_to_fd (from, tofd);
+   if (close (tofd) != 0)
+-- 
+cgit v1.0-41-gc330
+
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13638-and-CVE-2018-20969.patch b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13638-and-CVE-2018-20969.patch
new file mode 100644
index 000000000000..38caff628aaf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/CVE-2019-13638-and-CVE-2018-20969.patch
@@ -0,0 +1,38 @@
+From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 19:36:15 +0200
+Subject: Invoke ed directly instead of using the shell
+
+* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell
+command to avoid quoting vulnerabilities.
+---
+ src/pch.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index 4fd5a05..16e001a 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname,
+ 	    *outname_needs_removal = true;
+ 	    copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ 	  }
+-	sprintf (buf, "%s %s%s", editor_program,
+-		 verbosity == VERBOSE ? "" : "- ",
+-		 outname);
+ 	fflush (stdout);
+ 
+ 	pid = fork();
+@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname,
+ 	else if (pid == 0)
+ 	  {
+ 	    dup2 (tmpfd, 0);
+-	    execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
++	    assert (outname[0] != '!' && outname[0] != '-');
++	    execlp (editor_program, editor_program, "-", outname, (char  *) NULL);
+ 	    _exit (2);
+ 	  }
+ 	else
+-- 
+cgit v1.0-41-gc330
+
diff --git a/nixpkgs/pkgs/tools/text/gnupatch/default.nix b/nixpkgs/pkgs/tools/text/gnupatch/default.nix
new file mode 100644
index 000000000000..8cca7f15962a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnupatch/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl
+, ed, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  name = "patch-2.7.6";
+
+  src = fetchurl {
+    url = "mirror://gnu/patch/${name}.tar.xz";
+    sha256 = "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc";
+  };
+
+  patches = [
+    # https://git.savannah.gnu.org/cgit/patch.git/patch/?id=f290f48a621867084884bfff87f8093c15195e6a
+    ./CVE-2018-6951.patch
+
+    # https://git.savannah.gnu.org/cgit/patch.git/patch/?id=b5a91a01e5d0897facdd0f49d64b76b0f02b43e1
+    ./Allow_input_files_to_be_missing_for_ed-style_patches.patch
+
+    # https://git.savannah.gnu.org/cgit/patch.git/patch/?id=123eaff0d5d1aebe128295959435b9ca5909c26d
+    ./CVE-2018-1000156.patch
+
+    # https://git.savannah.gnu.org/cgit/patch.git/commit/?id=9c986353e420ead6e706262bf204d6e03322c300
+    ./CVE-2018-6952.patch
+
+    # https://git.savannah.gnu.org/cgit/patch.git/patch/?id=dce4683cbbe107a95f1f0d45fabc304acfb5d71a
+    ./CVE-2019-13636.patch
+
+    # https://git.savannah.gnu.org/cgit/patch.git/patch/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0
+    ./CVE-2019-13638-and-CVE-2018-20969.patch
+  ];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "ac_cv_func_strnlen_working=yes"
+  ];
+
+  doCheck = stdenv.hostPlatform.libc != "musl"; # not cross;
+  checkInputs = [ed];
+
+  meta = {
+    description = "GNU Patch, a program to apply differences to files";
+
+    longDescription =
+      '' GNU Patch takes a patch file containing a difference listing
+         produced by the diff program and applies those differences to one or
+         more original files, producing patched versions.
+      '';
+
+    homepage = "https://savannah.gnu.org/projects/patch";
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/gnused/422.nix b/nixpkgs/pkgs/tools/text/gnused/422.nix
new file mode 100644
index 000000000000..7ea637dc8c95
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnused/422.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "gnused-4.2.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/sed/sed-4.2.2.tar.bz2";
+    sha256 = "f048d1838da284c8bc9753e4506b85a1e0cc1ea8999d36f6995bcb9460cddbd7";
+  };
+
+  configureFlags = stdenv.lib.optional stdenv.hostPlatform.isMinGW "ac_cv_func__set_invalid_parameter_handler=no";
+
+  outputs = [ "out" "info" ];
+
+  meta = {
+    homepage = "https://www.gnu.org/software/sed/";
+    description = "GNU sed, a batch stream editor";
+
+    longDescription = ''
+      Sed (stream editor) isn't really a true text editor or text
+      processor.  Instead, it is used to filter text, i.e., it takes
+      text input and performs some operation (or set of operations) on
+      it and outputs the modified text.  Sed is typically used for
+      extracting part of a file using pattern matching or substituting
+      multiple occurrences of a string within a file.
+    '';
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/gnused/default.nix b/nixpkgs/pkgs/tools/text/gnused/default.nix
new file mode 100644
index 000000000000..d4da6f2c8ce8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gnused/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, perl }:
+
+stdenv.mkDerivation rec {
+  pname = "gnused";
+  version = "4.8";
+
+  src = fetchurl {
+    url = "mirror://gnu/sed/sed-${version}.tar.xz";
+    sha256 = "0cznxw73fzv1n3nj2zsq6nf73rvsbxndp444xkpahdqvlzz0r6zp";
+  };
+
+  outputs = [ "out" "info" ];
+
+  nativeBuildInputs = [ perl ];
+  preConfigure = "patchShebangs ./build-aux/help2man";
+
+  # Prevents attempts of running 'help2man' on cross-built binaries.
+  PERL = if stdenv.hostPlatform == stdenv.buildPlatform then null else "missing";
+
+  meta = {
+    homepage = "https://www.gnu.org/software/sed/";
+    description = "GNU sed, a batch stream editor";
+
+    longDescription = ''
+      Sed (stream editor) isn't really a true text editor or text
+      processor.  Instead, it is used to filter text, i.e., it takes
+      text input and performs some operation (or set of operations) on
+      it and outputs the modified text.  Sed is typically used for
+      extracting part of a file using pattern matching or substituting
+      multiple occurrences of a string within a file.
+    '';
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/grin/default.nix b/nixpkgs/pkgs/tools/text/grin/default.nix
new file mode 100644
index 000000000000..611507da75c7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/grin/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, python2Packages }:
+
+python2Packages.buildPythonApplication rec {
+  program = "grin";
+  version = "1.2.1";
+  name = "${program}-${version}";
+  namePrefix = "";
+
+  src = fetchFromGitHub {
+    owner = "rkern";
+    repo = program;
+    rev = "8dd4b5309b3bc04fe9d3e71836420f7d8d4a293f";
+    sha256 = "0vz2aahwdcy1296g4w3i79dkvmzk9jc2n2zmlcvlg5m3s6h7b6jd";
+  };
+
+  buildInputs = with python2Packages; [ nose ];
+
+  meta = {
+    homepage = "https://github.com/rkern/grin";
+    description = "A grep program configured the way I like it";
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ stdenv.lib.maintainers.sjagoe ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/grip-search/default.nix b/nixpkgs/pkgs/tools/text/grip-search/default.nix
new file mode 100644
index 000000000000..921691a40afd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/grip-search/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, boost, pkgconfig, cmake, catch2 }:
+
+stdenv.mkDerivation rec {
+  pname = "grip-search";
+  version = "0.8";
+
+  src = fetchFromGitHub {
+    owner = "sc0ty";
+    repo = "grip";
+    rev = "v${version}";
+    sha256 = "0bkqarylgzhis6fpj48qbifcd6a26cgnq8784hgnm707rq9kb0rx";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake catch2 ];
+
+  doCheck = true;
+
+  buildInputs = [ boost ];
+
+  patchPhase = ''
+    substituteInPlace src/general/config.h --replace "CUSTOM-BUILD" "${version}"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Fast, indexed regexp search over large file trees";
+    homepage = "https://github.com/sc0ty/grip";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ tex ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/groff/0001-Fix-cross-compilation-by-looking-for-ar.patch b/nixpkgs/pkgs/tools/text/groff/0001-Fix-cross-compilation-by-looking-for-ar.patch
new file mode 100644
index 000000000000..671293cda5b1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/groff/0001-Fix-cross-compilation-by-looking-for-ar.patch
@@ -0,0 +1,46 @@
+From 1454525f70b43a6957b7c9e1870e997368787da3 Mon Sep 17 00:00:00 2001
+From: Samuel Dionne-Riel <samuel@dionne-riel.com>
+Date: Fri, 8 Nov 2019 21:59:21 -0500
+Subject: [PATCH] Fix cross-compilation by looking for `ar`.
+
+---
+ Makefile.am  | 2 +-
+ configure.ac | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index d18c49b8..b1b53338 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -494,7 +494,7 @@ CCC=@CXX@
+ # INSTALL_INFO
+ # LN_S
+ 
+-AR=ar
++AR=@AR@
+ ETAGS=etags
+ ETAGSFLAGS=
+ # Flag that tells etags to assume C++.
+diff --git a/configure.ac b/configure.ac
+index 28e75f17..2449b9f5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -37,6 +37,7 @@ AC_CONFIG_AUX_DIR([build-aux])
+ 
+ AC_CONFIG_HEADERS([src/include/config.h:src/include/config.hin])
+ AC_CONFIG_SRCDIR([src/roff/groff/groff.cpp])
++AC_CONFIG_MACRO_DIR([m4])
+ 
+ AC_USE_SYSTEM_EXTENSIONS
+ 
+@@ -72,6 +73,7 @@ GROFF_DOC_CHECK
+ GROFF_MAKEINFO
+ GROFF_TEXI2DVI
+ AC_PROG_RANLIB
++AC_CHECK_TOOL([AR], [ar], [ar])
+ GROFF_INSTALL_SH
+ GROFF_INSTALL_INFO
+ AC_PROG_INSTALL
+-- 
+2.23.0
+
diff --git a/nixpkgs/pkgs/tools/text/groff/default.nix b/nixpkgs/pkgs/tools/text/groff/default.nix
new file mode 100644
index 000000000000..8c98a4aba465
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/groff/default.nix
@@ -0,0 +1,130 @@
+{ stdenv, fetchurl, perl
+, ghostscript #for postscript and html output
+, psutils, netpbm #for html output
+, buildPackages
+, autoreconfHook
+, pkgconfig
+, texinfo
+}:
+
+stdenv.mkDerivation rec {
+  pname = "groff";
+  version = "1.22.4";
+
+  src = fetchurl {
+    url = "mirror://gnu/groff/${pname}-${version}.tar.gz";
+    sha256 = "14q2mldnr1vx0l9lqp9v2f6iww24gj28iyh4j2211hyynx67p3p7";
+  };
+
+  outputs = [ "out" "man" "doc" "info" "perl" ];
+
+  enableParallelBuilding = false;
+
+  patches = [
+    ./0001-Fix-cross-compilation-by-looking-for-ar.patch
+  ];
+
+  postPatch = stdenv.lib.optionalString (psutils != null) ''
+    substituteInPlace src/preproc/html/pre-html.cpp \
+      --replace "psselect" "${psutils}/bin/psselect"
+  '' + stdenv.lib.optionalString (netpbm != null) ''
+    substituteInPlace src/preproc/html/pre-html.cpp \
+      --replace "pnmcut" "${stdenv.lib.getBin netpbm}/bin/pnmcut" \
+      --replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop" \
+      --replace "pnmtopng" "${stdenv.lib.getBin netpbm}/bin/pnmtopng"
+    substituteInPlace tmac/www.tmac \
+      --replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop" \
+      --replace "pngtopnm" "${stdenv.lib.getBin netpbm}/bin/pngtopnm" \
+      --replace "@PNMTOPS_NOSETPAGE@" "${stdenv.lib.getBin netpbm}/bin/pnmtops -nosetpage"
+  '';
+
+  buildInputs = [ ghostscript psutils netpbm perl ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig texinfo ];
+
+  # Builds running without a chroot environment may detect the presence
+  # of /usr/X11 in the host system, leading to an impure build of the
+  # package. To avoid this issue, X11 support is explicitly disabled.
+  # Note: If we ever want to *enable* X11 support, then we'll probably
+  # have to pass "--with-appresdir", too.
+  configureFlags = [
+    "--without-x"
+  ] ++ stdenv.lib.optionals (ghostscript != null) [
+    "--with-gs=${ghostscript}/bin/gs"
+  ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
+  ];
+
+  makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    # Trick to get the build system find the proper 'native' groff
+    # http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
+    "GROFF_BIN_PATH=${buildPackages.groff}/bin"
+    "GROFFBIN=${buildPackages.groff}/bin/groff"
+  ];
+
+  doCheck = true;
+
+  postInstall = ''
+    for f in 'man.local' 'mdoc.local'; do
+        cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
+    done
+
+    moveToOutput bin/gropdf $perl
+    moveToOutput bin/pdfmom $perl
+    moveToOutput bin/roff2text $perl
+    moveToOutput bin/roff2pdf $perl
+    moveToOutput bin/roff2ps $perl
+    moveToOutput bin/roff2dvi $perl
+    moveToOutput bin/roff2ps $perl
+    moveToOutput bin/roff2html $perl
+    moveToOutput bin/glilypond $perl
+    moveToOutput bin/mmroff $perl
+    moveToOutput bin/roff2x $perl
+    moveToOutput bin/afmtodit $perl
+    moveToOutput bin/gperl $perl
+    moveToOutput bin/chem $perl
+    moveToOutput share/groff/${version}/font/devpdf $perl
+
+    # idk if this is needed, but Fedora does it
+    moveToOutput share/groff/${version}/tmac/pdf.tmac $perl
+
+    moveToOutput bin/gpinyin $perl
+    moveToOutput lib/groff/gpinyin $perl
+    substituteInPlace $perl/bin/gpinyin \
+      --replace $out/lib/groff/gpinyin $perl/lib/groff/gpinyin
+
+    moveToOutput bin/groffer $perl
+    moveToOutput lib/groff/groffer $perl
+    substituteInPlace $perl/bin/groffer \
+      --replace $out/lib/groff/groffer $perl/lib/groff/groffer
+
+    moveToOutput bin/grog $perl
+    moveToOutput lib/groff/grog $perl
+    substituteInPlace $perl/bin/grog \
+      --replace $out/lib/groff/grog $perl/lib/groff/grog
+
+  '' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    find $perl/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|'
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.gnu.org/software/groff/";
+    description = "GNU Troff, a typesetting package that reads plain text and produces formatted output";
+    license = licenses.gpl3Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ pSub ];
+
+    longDescription = ''
+      groff is the GNU implementation of troff, a document formatting
+      system.  Included in this release are implementations of troff,
+      pic, eqn, tbl, grn, refer, -man, -mdoc, -mom, and -ms macros,
+      and drivers for PostScript, TeX dvi format, HP LaserJet 4
+      printers, Canon CAPSL printers, HTML and XHTML format (beta
+      status), and typewriter-like devices.  Also included is a
+      modified version of the Berkeley -me macros, the enhanced
+      version gxditview of the X11 xditview previewer, and an
+      implementation of the -mm macros.
+    '';
+
+    outputsToInstall = [ "out" "perl" ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/groff/site.tmac b/nixpkgs/pkgs/tools/text/groff/site.tmac
new file mode 100644
index 000000000000..8ef1040ca4a0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/groff/site.tmac
@@ -0,0 +1,16 @@
+.
+.if n \{\
+.  \" Character translations for non-keyboard
+.  \" characters - to make them searchable
+.  if '\*[.T]'utf8' \{\
+.    char \- \N'45'
+.    char - \N'45'
+.    char ' \N'39'
+.    char \' \N'39'
+.  \}
+.
+.  \" Shut off SGR by default (groff colors)
+.  \" Require GROFF_SGR envvar defined to turn it on
+.  if '\V[GROFF_SGR]'' \
+.    output x X tty: sgr 0
+.\}
diff --git a/nixpkgs/pkgs/tools/text/gtranslator/default.nix b/nixpkgs/pkgs/tools/text/gtranslator/default.nix
new file mode 100644
index 000000000000..ff5288f16316
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gtranslator/default.nix
@@ -0,0 +1,74 @@
+{ stdenv
+, fetchurl
+, meson
+, ninja
+, pkgconfig
+, itstool
+, gettext
+, python3
+, wrapGAppsHook
+, libxml2
+, libgda
+, libsoup
+, json-glib
+, gspell
+, glib
+, libdazzle
+, gtk3
+, gtksourceview4
+, gnome3
+, gsettings-desktop-schemas
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gtranslator";
+  version = "3.36.0";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "LaodO1m0o171TfCHNFsD4XA+clCB+drFQ1OSKKcVrdM=";
+  };
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkgconfig
+    itstool
+    gettext
+    python3
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    libxml2
+    glib
+    gtk3
+    libdazzle
+    gtksourceview4
+    libgda
+    libsoup
+    json-glib
+    gettext
+    gspell
+    gsettings-desktop-schemas
+  ];
+
+  postPatch = ''
+    chmod +x build-aux/meson/meson_post_install.py
+    patchShebangs build-aux/meson/meson_post_install.py
+  '';
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "GNOME translation making program";
+    homepage = "https://wiki.gnome.org/Apps/Gtranslator";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/gucci/default.nix b/nixpkgs/pkgs/tools/text/gucci/default.nix
new file mode 100644
index 000000000000..1667f2e45b54
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gucci/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "gucci";
+  version = "0.1.0";
+
+  goPackagePath = "github.com/noqcks/gucci";
+
+  src = fetchFromGitHub {
+    owner = "noqcks";
+    repo = "gucci";
+    rev = version;
+    sha256 = "0ksrmzb3iggc7gm51fl0jbb15d0gmpclslpkq2sl2xjzk29pkllq";
+  };
+
+  goDeps = ./deps.nix;
+
+  buildFlagsArray = ''
+    -ldflags=-X main.AppVersion=${version}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A simple CLI templating tool written in golang";
+    homepage = "https://github.com/noqcks/gucci";
+    license = licenses.mit;
+    maintainers = [ maintainers.braydenjw ];
+    platforms = platforms.unix;
+  };
+}
+
diff --git a/nixpkgs/pkgs/tools/text/gucci/deps.nix b/nixpkgs/pkgs/tools/text/gucci/deps.nix
new file mode 100644
index 000000000000..8e2cc5af3bf1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/gucci/deps.nix
@@ -0,0 +1,30 @@
+[
+  {
+    goPackagePath = "gopkg.in/yaml.v2";
+    fetch = {
+      type = "git";
+      url = "https://gopkg.in/yaml.v2";
+      rev = "5420a8b6744d3b0345ab293f6fcba19c978f1183";
+      sha256 = "0dwjrs2lp2gdlscs7bsrmyc5yf6mm4fvgw71bzr9mv2qrd2q73s1";
+    };
+  }
+  {
+    goPackagePath = "github.com/imdario/mergo";
+    fetch = {
+      type = "git";
+      url = "https://github.com/imdario/mergo";
+      rev = "v0.3.6";
+      sha256 = "1lbzy8p8wv439sqgf0n21q52flf2wbamp6qa1jkyv6an0nc952q7";
+    };
+  }
+  {
+    goPackagePath = "github.com/urfave/cli";
+    fetch = {
+      type = "git";
+      url = "https://github.com/urfave/cli";
+      rev = "v1.20.0";
+      sha256 = "0y6f4sbzkiiwrxbl15biivj8c7qwxnvm3zl2dd3mw4wzg4x10ygj";
+    };
+  }
+]
+
diff --git a/nixpkgs/pkgs/tools/text/highlight/default.nix b/nixpkgs/pkgs/tools/text/highlight/default.nix
new file mode 100644
index 000000000000..bc32a60c6727
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/highlight/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchFromGitLab, getopt, lua, boost, pkgconfig, swig, perl, gcc }:
+
+with stdenv.lib;
+
+let
+  self = stdenv.mkDerivation rec {
+    pname = "highlight";
+    version = "3.56";
+
+    src = fetchFromGitLab {
+      owner = "saalen";
+      repo = "highlight";
+      rev = "v${version}";
+      sha256 = "1pilx58dg96zm0yx7i6k92vibwpvpj8ir39f2akrsyjgijnv3sx4";
+    };
+
+    enableParallelBuilding = true;
+
+    nativeBuildInputs = [ pkgconfig swig perl ] ++ optional stdenv.isDarwin gcc;
+
+    buildInputs = [ getopt lua boost ];
+
+    prePatch = stdenv.lib.optionalString stdenv.cc.isClang ''
+      substituteInPlace src/makefile \
+          --replace 'CXX=g++' 'CXX=clang++'
+    '';
+
+    preConfigure = ''
+      makeFlags="PREFIX=$out conf_dir=$out/etc/highlight/ CXX=$CXX AR=$AR"
+    '';
+
+    # This has to happen _before_ the main build because it does a
+    # `make clean' for some reason.
+    preBuild = optionalString (!stdenv.isDarwin) ''
+      make -C extras/swig $makeFlags perl
+    '';
+
+    postCheck = optionalString (!stdenv.isDarwin) ''
+      perl -Iextras/swig extras/swig/testmod.pl
+    '';
+
+    preInstall = optionalString (!stdenv.isDarwin) ''
+      mkdir -p $out/${perl.libPrefix}
+      install -m644 extras/swig/highlight.{so,pm} $out/${perl.libPrefix}
+      make -C extras/swig clean # Clean up intermediate files.
+    '';
+
+    meta = with stdenv.lib; {
+      description = "Source code highlighting tool";
+      homepage = "http://www.andre-simon.de/doku/highlight/en/highlight.php";
+      platforms = platforms.unix;
+      maintainers = with maintainers; [ willibutz ];
+    };
+  };
+
+in
+  if stdenv.isDarwin then self
+  else perl.pkgs.toPerlModule self
diff --git a/nixpkgs/pkgs/tools/text/html-tidy/default.nix b/nixpkgs/pkgs/tools/text/html-tidy/default.nix
new file mode 100644
index 000000000000..28e1759fea59
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/html-tidy/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, libxslt }:
+
+stdenv.mkDerivation rec {
+  pname = "html-tidy";
+  version = "5.6.0";
+
+  src = fetchFromGitHub {
+    owner = "htacg";
+    repo = "tidy-html5";
+    rev = version;
+    sha256 = "0w175c5d1babq0w1zzdzw9gl6iqbgyq58v8587s7srp05y3hwy9k";
+  };
+
+  nativeBuildInputs = [ cmake libxslt/*manpage*/ ];
+
+  cmakeFlags = [];
+
+  # ATM bin/tidy is statically linked, as upstream provides no other option yet.
+  # https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107
+
+  meta = with stdenv.lib; {
+    description = "A HTML validator and `tidier'";
+    longDescription = ''
+      HTML Tidy is a command-line tool and C library that can be
+      used to validate and fix HTML data.
+    '';
+    license = licenses.libpng; # very close to it - the 3 clauses are identical
+    homepage = "http://html-tidy.org";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/html2text/default.nix b/nixpkgs/pkgs/tools/text/html2text/default.nix
new file mode 100644
index 000000000000..7cf276f2da3b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/html2text/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "html2text-1.3.2a";
+
+  src = fetchurl {
+    url = "http://www.mbayer.de/html2text/downloads/html2text-1.3.2a.tar.gz";
+    sha256 = "000b39d5d910b867ff7e087177b470a1e26e2819920dcffd5991c33f6d480392";
+  };
+
+  preConfigure = ''
+    substituteInPlace configure \
+        --replace /bin/echo echo \
+        --replace CXX=unknown ':'
+  '';
+
+  # the --prefix has no effect
+  installPhase = ''
+    mkdir -p $out/bin $out/man/man{1,5}
+    cp html2text $out/bin
+    cp html2text.1.gz $out/man/man1
+    cp html2textrc.5.gz $out/man/man5
+  '';
+
+  meta = {
+    description = "Convert HTML to plain text";
+    homepage = "http://www.mbayer.de/html2text/";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.eikek ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/hyx/default.nix b/nixpkgs/pkgs/tools/text/hyx/default.nix
new file mode 100644
index 000000000000..83fdabb8f46f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/hyx/default.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "hyx-0.1.5";
+
+  src = fetchurl {
+    url = "https://yx7.cc/code/hyx/${name}.tar.xz";
+    sha256 = "0gd8fbdyw12jwffa5dgcql4ry22xbdhqdds1qwzk1rkcrkgnc1mg";
+  };
+
+  patches = [ ./no-wall-by-default.patch ];
+
+  installPhase = ''
+    install -vD hyx $out/bin/hyx
+  '';
+
+  meta = with lib; {
+    description = "minimalistic but powerful Linux console hex editor";
+    homepage = "https://yx7.cc/code/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/hyx/no-wall-by-default.patch b/nixpkgs/pkgs/tools/text/hyx/no-wall-by-default.patch
new file mode 100644
index 000000000000..48ee20eff179
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/hyx/no-wall-by-default.patch
@@ -0,0 +1,11 @@
+--- hyx-0.1.5.org/Makefile	2018-06-02 17:14:37.000000000 +0100
++++ hyx-0.1.5/Makefile	2018-11-10 09:25:49.569961762 +0000
+@@ -1,7 +1,7 @@
+ 
+ all: CFLAGS ?= -O2 -Wl,-s \
+                -Wl,-z,relro,-z,now -fpic -pie -D_FORTIFY_SOURCE=2 -fstack-protector-all
+-all: CFLAGS += -std=c99 -pedantic -Wall -Wextra -DNDEBUG
++all: CFLAGS += -std=c99 -DNDEBUG
+ all: hyx
+ 
+ debug: CFLAGS ?= -O0 -g \
diff --git a/nixpkgs/pkgs/tools/text/icdiff/default.nix b/nixpkgs/pkgs/tools/text/icdiff/default.nix
new file mode 100644
index 000000000000..15739432a19f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/icdiff/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchFromGitHub, pythonPackages }:
+
+pythonPackages.buildPythonApplication rec {
+  pname = "icdiff";
+  version = "1.9.5";
+
+  src = fetchFromGitHub {
+    owner = "jeffkaufman";
+    repo = "icdiff";
+    rev = "release-${version}";
+    sha256 = "080v8h09pv8qwplin4kwfm0kmqjwdqjfxbpcdrv16sv4hwfwl5qd";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.jefftk.com/icdiff";
+    description = "Side-by-side highlighted command line diffs";
+    maintainers = with maintainers; [ aneeshusa ];
+    license = licenses.psfl;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/invoice2data/default.nix b/nixpkgs/pkgs/tools/text/invoice2data/default.nix
new file mode 100644
index 000000000000..78ab971f0c0d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/invoice2data/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, python3Packages, xpdf, imagemagick, tesseract }:
+
+python3Packages.buildPythonPackage rec {
+  pname = "invoice2data";
+  version = "0.2.93";
+
+  src = python3Packages.fetchPypi {
+    inherit pname version;
+    sha256 = "1phz0a8jxg074k0im7shrrdfvdps7bn1fa4zwcf8q3sa2iig26l4";
+  };
+
+  makeWrapperArgs = ["--prefix" "PATH" ":" (stdenv.lib.makeBinPath [ imagemagick xpdf tesseract ]) ];
+
+  propagatedBuildInputs = with python3Packages; [ unidecode dateparser pyyaml pillow chardet pdfminer ];
+
+  # Tests fails even when ran manually on my ubuntu machine !!
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Data extractor for PDF invoices";
+    homepage = "https://github.com/invoice-x/invoice2data";
+    license = licenses.mit;
+    maintainers = with maintainers; [ psyanticy ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ispell/default.nix b/nixpkgs/pkgs/tools/text/ispell/default.nix
new file mode 100644
index 000000000000..2f61536ed2c0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, bison, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "ispell";
+  version = "3.4.00";
+
+  src = fetchurl {
+    url = "http://fmg-www.cs.ucla.edu/geoff/tars/${pname}-${version}.tar.gz";
+    sha256 = "1d7c2fqrdjckp91ajpkn5nnmpci2qrxqn8b6cyl0zn1afb9amxbz";
+  };
+
+  buildInputs = [ bison ncurses ];
+
+  patches = [
+    ./patches/0007-Use-termios.patch
+    ./patches/0008-Tex-backslash.patch
+    ./patches/0009-Fix-FTBFS-on-glibc.patch
+    ./patches/0011-Missing-prototypes.patch
+    ./patches/0012-Fix-getline.patch
+    ./patches/0013-Fix-man-pages.patch
+    ./patches/0021-Fix-gcc-warnings.patch
+    ./patches/0023-Exclusive-options.patch
+    ./patches/0024-Check-tempdir-creation.patch
+    ./patches/0025-Languages.patch
+    ./patches/0030-Display-whole-multibyte-character.patch
+  ];
+
+  postPatch = ''
+    cat >> local.h <<EOF
+    ${stdenv.lib.optionalString (!stdenv.isDarwin) "#define USG"}
+    #define TERMLIB "-lncurses"
+    #define LANGUAGES "{american,MASTERDICTS=american.med,HASHFILES=americanmed.hash}"
+    #define MASTERHASH "americanmed.hash"
+    #define BINDIR "$out/bin"
+    #define LIBDIR "$out/lib"
+    #define ELISPDIR "{$out}/share/emacs/site-lisp"
+    #define TEXINFODIR "$out/share/info"
+    #define MAN1DIR "$out/share/man/man1"
+    #define MAN4DIR "$out/share/man/man4"
+    #define MAN45DIR "$out/share/man/man5"
+    #define MINIMENU
+    #define HAS_RENAME
+    EOF
+  '';
+
+  preBuild = ''
+    for dir in $out/share/emacs/site-lisp $out/share/info $out/share/man/man1 $out/share/man/man4 $out/bin $out/lib; do
+    mkdir -p $dir
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An interactive spell-checking program for Unix";
+    homepage = "https://www.cs.hmc.edu/~geoff/ispell.html";
+    license = licenses.free;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0007-Use-termios.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0007-Use-termios.patch
new file mode 100644
index 000000000000..299e3c01ab13
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0007-Use-termios.patch
@@ -0,0 +1,188 @@
+From: Torsten Landschoff <t.landschoff@gmx.net>
+Date: Tue, 30 Mar 1999 21:05:09 +0100
+Subject: 0007 Use termios
+
+Use termios instead of termio (Closes: #35288).
+
+Patch updated on Mon, 07 Mar 2011 20:40:53 +0100 based on
+ispell-3.3.02-terminal.patch from ispell-3.3.02-102.1.src.rpm
+---
+ term.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 58 insertions(+), 0 deletions(-)
+
+diff --git a/term.c b/term.c
+index 4923844..47c1aa0 100644
+--- a/term.c
++++ b/term.c
+@@ -87,13 +87,22 @@ static char Rcs_Id[] =
+ #include "proto.h"
+ #include "msgs.h"
+ #ifdef USG
++#if defined(__GLIBC__) && __GLIBC__ >= 2
++/* Use termios under at least glibc */
++  #include <termios.h>
++  #define USE_TERMIOS
++#else
+ #include <termio.h>
++#endif
+ #else
+ #ifndef __DJGPP__
+ #include <sgtty.h>
+ #endif
+ #endif
+ #include <signal.h>
++#include <unistd.h>
++#include <sys/types.h>
++#include <sys/wait.h>
+ 
+ void		ierase P ((void));
+ void		imove P ((int row, int col));
+@@ -166,8 +175,13 @@ static int iputch (c)
+     }
+ 
+ #ifdef USG
++#ifdef USE_TERMIOS
++static struct termios	sbuf;
++static struct termios	osbuf;
++#else
+ static struct termio	sbuf;
+ static struct termio	osbuf;
++#endif
+ #else
+ static struct sgttyb	sbuf;
+ static struct sgttyb	osbuf;
+@@ -190,9 +204,13 @@ void terminit ()
+     int			tpgrp;
+ #else
+ #ifdef TIOCGPGRP
++#ifdef USE_TERMIOS
++    pid_t		tpgrp;
++#else
+     int			tpgrp;
+ #endif
+ #endif
++#endif
+ #ifdef TIOCGWINSZ
+     struct winsize	wsize;
+ #endif /* TIOCGWINSZ */
+@@ -276,7 +294,11 @@ retry:
+ 	(void) fprintf (stderr, TERM_C_NO_BATCH);
+ 	exit (1);
+ 	}
++#ifdef USE_TERMIOS
++    (void) tcgetattr (0, &osbuf);
++#else
+     (void) ioctl (0, TCGETA, (char *) &osbuf);
++#endif
+     termchanged = 1;
+ 
+     sbuf = osbuf;
+@@ -285,7 +307,11 @@ retry:
+     sbuf.c_iflag &= ~(INLCR | IGNCR | ICRNL);
+     sbuf.c_cc[VMIN] = 1;
+     sbuf.c_cc[VTIME] = 1;
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSADRAIN, &sbuf);
++#else
+     (void) ioctl (0, TCSETAW, (char *) &sbuf);
++#endif
+ 
+     uerasechar = osbuf.c_cc[VERASE];
+     ukillchar = osbuf.c_cc[VKILL];
+@@ -298,7 +324,11 @@ retry:
+ #endif
+ #endif
+ #ifdef TIOCGPGRP
++#ifdef USE_TERMIOS
++    if ((tpgrp = tcgetpgrp (0)) == -1)
++#else
+     if (ioctl (0, TIOCGPGRP, (char *) &tpgrp) != 0)
++#endif
+ 	{
+ 	(void) fprintf (stderr, TERM_C_NO_BATCH);
+ 	exit (1);
+@@ -373,7 +403,11 @@ SIGNAL_TYPE done (signo)
+ 	if (te)
+ 	    tputs (te, 1, iputch);
+ #ifdef USG
++#ifdef USE_TERMIOS
++	(void) tcsetattr (0, TCSADRAIN, &osbuf);
++#else
+ 	(void) ioctl (0, TCSETAW, (char *) &osbuf);
++#endif
+ #else
+ 	(void) ioctl (0, TIOCSETP, (char *) &osbuf);
+ #ifdef TIOCSLTC
+@@ -394,7 +428,11 @@ static SIGNAL_TYPE onstop (signo)
+ 	if (te)
+ 	    tputs (te, 1, iputch);
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSANOW, &osbuf); /* OpenSuse: TCSADRAIN */
++#else
+ 	(void) ioctl (0, TCSETAW, (char *) &osbuf);
++#endif
+ #else
+ 	(void) ioctl (0, TIOCSETP, (char *) &osbuf);
+ #ifdef TIOCSLTC
+@@ -413,7 +451,11 @@ static SIGNAL_TYPE onstop (signo)
+     if (termchanged)
+ 	{
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSANOW, &sbuf);
++#else
+ 	(void) ioctl (0, TCSETAW, (char *) &sbuf);
++#endif
+ #else
+ 	(void) ioctl (0, TIOCSETP, (char *) &sbuf);
+ #ifdef TIOCSLTC
+@@ -481,7 +523,11 @@ int shellescape	(buf)
+     argv[i] = NULL;
+ 
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSADRAIN, &osbuf);
++#else
+     (void) ioctl (0, TCSETAW, (char *) &osbuf);
++#endif
+ #else
+     (void) ioctl (0, TIOCSETP, (char *) &osbuf);
+ #ifdef TIOCSLTC
+@@ -527,7 +573,11 @@ int shellescape	(buf)
+ #endif
+ 
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSADRAIN, &sbuf);
++#else
+     (void) ioctl (0, TCSETAW, (char *) &sbuf);
++#endif
+ #else
+     (void) ioctl (0, TIOCSETP, (char *) &sbuf);
+ #ifdef TIOCSLTC
+@@ -563,7 +613,11 @@ void shescape (buf)
+ #endif
+ 
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSADRAIN, &osbuf);
++#else
+     (void) ioctl (0, TCSETAW, (char *) &osbuf);
++#endif
+ #else
+     (void) ioctl (0, TIOCSETP, (char *) &osbuf);
+ #ifdef TIOCSLTC
+@@ -611,7 +665,11 @@ void shescape (buf)
+ #endif
+ 
+ #ifdef USG
++#ifdef USE_TERMIOS
++    (void) tcsetattr (0, TCSADRAIN, &sbuf);
++#else
+     (void) ioctl (0, TCSETAW, (char *) &sbuf);
++#endif
+ #else
+     (void) ioctl (0, TIOCSETP, (char *) &sbuf);
+ #ifdef TIOCSLTC
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0008-Tex-backslash.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0008-Tex-backslash.patch
new file mode 100644
index 000000000000..21b44d505db0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0008-Tex-backslash.patch
@@ -0,0 +1,48 @@
+From: Ken Stevens <kstevens@ece.utah.edu>
+Date: Sat, 15 Jul 2000 22:10:53 -0400
+Subject: 0008 Tex backslash
+
+Version 3.1.20 contains an irritating bug when using latex that causes all
+sorts of problems when the backslash is used. (The backslash is a common
+character in latex that is used, among other things, to create a forced space
+similar to the tilde character.) In the current version, 3.1.20, the next TWO
+characters are skipped after a backslash. This can results in misspellings and
+the file being incorrectly parsed. (For example, if the text contains the
+sequence `\ $' math mode will not be entered until the matching $ which should
+end it, resulting in the body of the text not being spell checked and the math
+region being checked.)
+
+Make sure to undefine NO8BIT and use a larger number for MASKBITS if you are
+using iso character sets.
+
+http://www.kdstevens.com/~stevens/ispell-faq.html#bslash
+---
+ defmt.c |    7 +++----
+ 1 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/defmt.c b/defmt.c
+index 35f93e4..7499752 100644
+--- a/defmt.c
++++ b/defmt.c
+@@ -884,6 +884,8 @@ static int TeX_math_end (bufp)
+ 	return 0;
+     }
+ 
++/* Updates bufp to point to the next character to skip. */
++/*  Should only be called on non-word characters. */
+ static int TeX_math_begin (bufp)
+     unsigned char **	bufp;
+     {
+@@ -902,10 +904,7 @@ static int TeX_math_begin (bufp)
+ 	if (**bufp == TEXLEFTPAREN  ||  **bufp == TEXLEFTSQUARE)
+ 	    return 1;
+ 	else if (!isalpha(**bufp)  &&  **bufp != '@')
+-	    {
+-	    (*bufp)++;
+-	    continue;
+-	    }
++	    return 0;
+ 	else if (TeX_strncmp (*bufp, "begin", 5) == 0)
+ 	    {
+ 	    if (TeX_math_check ('b', bufp))
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0009-Fix-FTBFS-on-glibc.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0009-Fix-FTBFS-on-glibc.patch
new file mode 100644
index 000000000000..dbe0db9a0533
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0009-Fix-FTBFS-on-glibc.patch
@@ -0,0 +1,23 @@
+From: Richard Braakman <dark@dark.wapit.fi>
+Date: Fri, 2 Feb 2001 17:22:53 +0200
+Subject: 0009 Fix FTBFS on glibc
+
+Fix FTBFS on glibc (Closes: #75377)
+---
+ config.X |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/config.X b/config.X
+index 18bf621..0a47cb2 100644
+--- a/config.X
++++ b/config.X
+@@ -531,7 +531,7 @@
+ #endif /* NO_MKSTEMP */
+ 
+ /* Aliases for some routines */
+-#ifdef USG
++#if defined (USG) && !defined(__GLIBC__)
+ #define BCOPY(s, d, n)	memcpy (d, s, n)
+ #define BZERO(d, n)	memset (d, 0, n)
+ #define index strchr
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0011-Missing-prototypes.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0011-Missing-prototypes.patch
new file mode 100644
index 000000000000..5e77b6a4f371
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0011-Missing-prototypes.patch
@@ -0,0 +1,84 @@
+From: Doug Porter <dsp@debian.org>
+Date: Tue, 22 Jan 2002 10:28:44 -0500
+Subject: 0011 Missing prototypes
+
+Fixing implicit declarations (Closes: #130405).
+---
+ correct.c |    1 +
+ ijoin.c   |    2 +-
+ ispell.c  |    2 ++
+ lookup.c  |    2 ++
+ tree.c    |    1 +
+ 5 files changed, 7 insertions(+), 1 deletions(-)
+
+diff --git a/correct.c b/correct.c
+index e2b63c8..661bf57 100644
+--- a/correct.c
++++ b/correct.c
+@@ -201,6 +201,7 @@ static char Rcs_Id[] =
+  */
+ 
+ #include <ctype.h>
++#include <unistd.h>
+ #include "config.h"
+ #include "ispell.h"
+ #include "proto.h"
+diff --git a/ijoin.c b/ijoin.c
+index edb18d1..5da039a 100644
+--- a/ijoin.c
++++ b/ijoin.c
+@@ -115,6 +115,7 @@ static char Rcs_Id[] =
+  */
+ 
+ #include <stdio.h>
++#include <string.h>
+ #include "config.h"
+ #include "ispell.h"
+ #include "proto.h"
+@@ -169,7 +170,6 @@ static char *		tabchar = " \t"; /* Field separator character(s) */
+ static int		unpairable1 = 0; /* NZ if -a1 */
+ static int		unpairable2 = 0; /* NZ if -a2 */
+ 
+-extern int	strcmp ();
+ 
+ int main (argc, argv)			/* Join files */
+     int			argc;		/* Argument count */
+diff --git a/ispell.c b/ispell.c
+index 9b509d0..59fe358 100644
+--- a/ispell.c
++++ b/ispell.c
+@@ -235,6 +235,8 @@ static char Rcs_Id[] =
+ #include <fcntl.h>
+ #endif /* NO_FCNTL_H */
+ #include <sys/stat.h>
++#include <ctype.h>
++#include <unistd.h>
+ 
+ static void	usage P ((void));
+ int		main P ((int argc, char * argv[]));
+diff --git a/lookup.c b/lookup.c
+index 648f9c8..8bf1f6c 100644
+--- a/lookup.c
++++ b/lookup.c
+@@ -87,6 +87,8 @@ static char Rcs_Id[] =
+ 
+ #include <fcntl.h>
+ 
++#include <sys/types.h>
++#include <unistd.h>
+ #include "config.h"
+ #include "ispell.h"
+ #include "proto.h"
+diff --git a/tree.c b/tree.c
+index 073a6a6..c26f635 100644
+--- a/tree.c
++++ b/tree.c
+@@ -94,6 +94,7 @@ static char Rcs_Id[] =
+ 
+ #include <ctype.h>
+ #include <errno.h>
++#include <unistd.h>
+ #include "config.h"
+ #include "ispell.h"
+ #include "proto.h"
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0012-Fix-getline.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0012-Fix-getline.patch
new file mode 100644
index 000000000000..ea966d67792e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0012-Fix-getline.patch
@@ -0,0 +1,62 @@
+From: Stefan Potyra <sistpoty@ubuntu.com>
+Date: Sat, 3 Oct 2009 04:00:34 +0200
+Subject: 0012 Fix getline
+
+getline is not provided by eglibc, avoid conflict
+
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549401
+Forwarded: no
+---
+ correct.c |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/correct.c b/correct.c
+index 661bf57..ff7cb99 100644
+--- a/correct.c
++++ b/correct.c
+@@ -246,7 +246,7 @@ static void	save_root_cap P ((ichar_t * word, ichar_t * pattern,
+ 		  struct flagent * sufent,
+ 		  ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
+ 		  int * nsaved));
+-static char *	getline P ((char * buf, int bufsize));
++static char *	getline_ispell P ((char * buf, int bufsize));
+ void		askmode P ((void));
+ void		copyout P ((unsigned char ** cc, int cnt));
+ static void	lookharder P ((unsigned char * string));
+@@ -572,7 +572,7 @@ checkagain:
+ 
+ 		imove (li - 1, 0);
+ 		(void) putchar ('!');
+-		if (getline ((char *) buf, sizeof buf) == NULL)
++		if (getline_ispell ((char *) buf, sizeof buf) == NULL)
+ 		    {
+ 		    (void) putchar (7);
+ 		    ierase ();
+@@ -597,7 +597,7 @@ checkagain:
+ 		    (void) printf ("%s ", CORR_C_READONLY);
+ 		    }
+ 		(void) printf (CORR_C_REPLACE_WITH);
+-		if (getline ((char *) ctok, ctokl) == NULL)
++		if (getline_ispell ((char *) ctok, ctokl) == NULL)
+ 		    {
+ 		    (void) putchar (7);
+ 		    /* Put it back */
+@@ -665,7 +665,7 @@ checkagain:
+ 		unsigned char	buf[100];
+ 		imove (li - 1, 0);
+ 		(void) printf (CORR_C_LOOKUP_PROMPT);
+-		if (getline ((char *) buf, sizeof buf) == NULL)
++		if (getline_ispell ((char *) buf, sizeof buf) == NULL)
+ 		    {
+ 		    (void) putchar (7);
+ 		    ierase ();
+@@ -1584,7 +1584,7 @@ static void save_root_cap (word, pattern, prestrip, preadd, sufstrip, sufadd,
+     return;
+     }
+ 
+-static char * getline (s, len)
++static char * getline_ispell(s, len)
+     register char *	s;
+     register int	len;
+     {
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0013-Fix-man-pages.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0013-Fix-man-pages.patch
new file mode 100644
index 000000000000..9c0aedb67d76
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0013-Fix-man-pages.patch
@@ -0,0 +1,227 @@
+From: David Paleino <d.paleino@gmail.com>
+Date: Mon, 9 Nov 2009 09:22:12 +0000
+Subject: 0013 Fix man pages
+
+Fix man pages, manpage-has-errors-from-man and hyphen-used-as-minus-sign
+
+Forwarded: no
+---
+ ispell.1X |   26 +++++++++++++-------------
+ ispell.5X |   26 +++++++++++++-------------
+ 2 files changed, 26 insertions(+), 26 deletions(-)
+
+diff --git a/ispell.1X b/ispell.1X
+index b27b120..79894d4 100644
+--- a/ispell.1X
++++ b/ispell.1X
+@@ -236,8 +236,8 @@ count affix-file
+ .RB [ \-p | \-s]
+ .RB [ \-c ]
+ .I expanded-file
+-.IR affix [ +addition ]
+-...
++.IR affix
++.RI [ +addition ]
+ .PP
+ .B icombine
+ .RB [ \-T
+@@ -336,7 +336,7 @@ The amount of context is subject to a system-imposed limit.
+ If the
+ .B \-V
+ flag is given, characters that are not in the 7-bit ANSI printable
+-character set will always be displayed in the style of "cat -v", even if
++character set will always be displayed in the style of "cat \-v", even if
+ .I ispell
+ thinks that these characters are legal ISO Latin-1 on your system.
+ This is useful when working with older terminals.
+@@ -542,7 +542,7 @@ option is used to specify an alternate hashed dictionary file,
+ other than the default.
+ If the filename does not contain a "/",
+ the library directory for the default dictionary file is prefixed;
+-thus, to use a dictionary in the local directory "-d ./xxx.hash" must
++thus, to use a dictionary in the local directory "\-d ./xxx.hash" must
+ be used.
+ This is useful to allow dictionaries for alternate languages.
+ Unlike previous versions of
+@@ -615,7 +615,7 @@ alphabetics have no meaning - alphabetics are already accepted.
+ .I Ispell
+ will typically be used with input from a file, meaning that preserving
+ parity for possible 8 bit characters from the input text is OK.  If you
+-specify the -l option, and actually type text from the terminal, this may
++specify the \-l option, and actually type text from the terminal, this may
+ create problems if your stty settings preserve parity.
+ .PP
+ It is not possible to use
+@@ -799,7 +799,7 @@ that the '&' is replaced by '?' (and the near-miss count is always zero).
+ The suggested derivations following the near misses are in the form:
+ .PP
+ .RS
+-[prefix+] root [-prefix] [-suffix] [+suffix]
++[prefix+] root [\-prefix] [\-suffix] [+suffix]
+ .RE
+ .PP
+ (e.g., "re+fry-y+ies" to get "refries")
+@@ -841,7 +841,7 @@ These output lines can be summarized as follows:
+ .PP
+ For example, a dummy dictionary containing the words "fray", "Frey",
+ "fry", and "refried" might produce the following response to the
+-command "echo 'frqy refries | ispell -a -m -d ./test.hash":
++command "echo 'frqy refries | ispell \-a \-m \-d ./test.hash":
+ .RS
+ .nf
+ (#) International Ispell Version 3.0.05 (beta), 08/10/91
+@@ -1036,7 +1036,7 @@ script does this.
+ As an example, the command:
+ .PP
+ .RS
+-echo BOTHER | ispell -c
++echo BOTHER | ispell \-c
+ .RE
+ .PP
+ produces:
+@@ -1055,7 +1055,7 @@ it expands affix flags to produce a list of words.
+ For example, the command:
+ .PP
+ .RS
+-echo BOTH/R | ispell -e
++echo BOTH/R | ispell \-e
+ .RE
+ .PP
+ produces:
+@@ -1268,7 +1268,7 @@ hash file if it were added to the language table.
+ Only affixes that generate legal roots (found in the original input)
+ are listed.
+ .PP
+-If the "-c" option is not given, the output lines are in the
++If the "\-c" option is not given, the output lines are in the
+ following format:
+ .IP
+ strip/add/count/bytes
+@@ -1298,7 +1298,7 @@ If the
+ the output is made visually cleaner (but harder to post-process)
+ by changing it to:
+ .IP
+--strip+add<tab>count<tab>bytes
++\-strip+add<tab>count<tab>bytes
+ .PP
+ where
+ .IR strip ,
+@@ -1313,7 +1313,7 @@ represents the ASCII tab character.
+ The method used to generate possible affixes will also generate
+ longer affixes which have common headers or trailers.  For example,
+ the two words "moth" and "mother" will generate not only the obvious
+-substitution "+er" but also "-h+her" and "-th+ther" (and possibly
++substitution "+er" but also "\-h+her" and "\-th+ther" (and possibly
+ even longer ones, depending on the value of
+ .IR min ).
+ To prevent
+@@ -1621,7 +1621,7 @@ redirected.
+ However, a lot of the temporary space needed is for sorting, so TMPDIR
+ is only a partial help on systems with an uncooperative
+ .IR sort (1).
+-("Cooperative" is defined as accepting the undocumented -T switch).
++("Cooperative" is defined as accepting the undocumented \-T switch).
+ At its peak usage,
+ .I munchlist
+ takes 10 to 40 times the original
+diff --git a/ispell.5X b/ispell.5X
+index ab526ed..7a1c2e5 100644
+--- a/ispell.5X
++++ b/ispell.5X
+@@ -137,8 +137,8 @@ This feature can be used to convert an entire dictionary if necessary:)
+ 	echo qqqqq > dummy.dict
+ 	buildhash dummy.dict \fIaffix-file\fP dummy.hash
+ 	awk '{print "*"}END{print "#"}' \fIold-dict-file\fP \e
+-	| ispell -a -T \fIold-dict-string-type\fP \e
+-	  -d ./dummy.hash -p ./\fInew-dict-file\fP \e
++	| ispell \-a \-T \fIold-dict-string-type\fP \e
++	  \-d ./dummy.hash \-p ./\fInew-dict-file\fP \e
+ 	  > /dev/null
+ 	rm dummy.*
+ .fi
+@@ -622,7 +622,7 @@ or
+ .B stringchar
+ statements.
+ For example, if the hyphen is a boundary character (useful in French),
+-the string "foo-bar" would be a single word, but "-foo" would be the
++the string "foo-bar" would be a single word, but "\-foo" would be the
+ same as "foo", and "foo--bar" would be two words separated by non-word
+ characters.
+ .PP
+@@ -916,7 +916,7 @@ The following (suffix) replacements:
+ .RS
+ .nf
+ \&.	>	MENT
+-Y	>	-Y,IES
++Y	>	\-Y,IES
+ .fi
+ .RE
+ .PP
+@@ -956,8 +956,8 @@ Instead, you must use two separate rules:
+ .PP
+ .RS
+ .nf
+-E	>	-E,IES
+-Y	>	-Y,IES
++E	>	\-E,IES
++Y	>	\-Y,IES
+ .fi
+ .RE
+ .PP
+@@ -1005,7 +1005,7 @@ For example, to specify words ending in "ED", write:
+ .PP
+ .RS
+ .nf
+-E D	>	-ED,ING		# As in covered > covering
++E D	>	\-ED,ING		# As in covered > covering
+ .fi
+ .RE
+ .PP
+@@ -1013,7 +1013,7 @@ If you write:
+ .PP
+ .RS
+ .nf
+-ED	>	-ED,ING
++ED	>	\-ED,ING
+ .fi
+ .RE
+ .PP
+@@ -1021,7 +1021,7 @@ the effect will be the same as:
+ .PP
+ .RS
+ .nf
+-[ED]	>	-ED,ING
++[ED]	>	\-ED,ING
+ .fi
+ .RE
+ .PP
+@@ -1047,7 +1047,7 @@ is useful, as in the following example:
+ .PP
+ .RS
+ .nf
+-$ munchlist -c oldaffixes -l newaffixes olddict > newdict
++$ munchlist \-c oldaffixes \-l newaffixes olddict > newdict
+ .fi
+ .RE
+ .PP
+@@ -1070,7 +1070,7 @@ flag from the English affix file:
+ .RS
+ .nf
+ flag *S:
+-    [^AEIOU]Y	>	-Y,IES	# As in imply > implies
++    [^AEIOU]Y	>	\-Y,IES	# As in imply > implies
+     [AEIOU]Y	>	S		# As in convey > conveys
+     [SXZH]	>	ES		# As in fix > fixes
+     [^SXZHY]	>	S		# As in bat > bats
+@@ -1099,8 +1099,8 @@ For example, we could extend the English "R" flag as follows:
+ flag *R:
+    E			>	R		# As in skate > skater
+    E			>	RS		# As in skate > skaters
+-   [^AEIOU]Y	>	-Y,IER	# As in multiply > multiplier
+-   [^AEIOU]Y	>	-Y,IERS	# As in multiply > multipliers
++   [^AEIOU]Y	>	\-Y,IER	# As in multiply > multiplier
++   [^AEIOU]Y	>	\-Y,IERS	# As in multiply > multipliers
+    [AEIOU]Y	>	ER		# As in convey > conveyer
+    [AEIOU]Y	>	ERS		# As in convey > conveyers
+    [^EY]		>	ER		# As in build > builder
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0021-Fix-gcc-warnings.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0021-Fix-gcc-warnings.patch
new file mode 100644
index 000000000000..8902018dab58
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0021-Fix-gcc-warnings.patch
@@ -0,0 +1,57 @@
+From: Robert Luberda <robert@debian.org>
+Date: Mon, 7 Mar 2011 22:23:56 +0100
+Subject: 0021 Fix gcc warnings
+
+Fix some gcc warnings.
+---
+ correct.c                |    2 +-
+ languages/english/msgs.h |    8 ++++----
+ tree.c                   |    2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/correct.c b/correct.c
+index 79b259f..982b7c6 100644
+--- a/correct.c
++++ b/correct.c
+@@ -825,7 +825,7 @@ static void inserttoken (buf, start, tok, curchar, oktochange)
+ 	for (p = start;  p != *curchar;  p++)
+ 	    (void) putc (*p, logfile);
+ 	(void) putc (' ', logfile);
+-	(void) fputs (tok, logfile);
++	(void) fputs ((char*) tok, logfile);
+ 	(void) putc ('\n', logfile);
+ 	(void) fflush (logfile);
+ 	}
+diff --git a/languages/english/msgs.h b/languages/english/msgs.h
+index d33b42b..f9c87ca 100644
+--- a/languages/english/msgs.h
++++ b/languages/english/msgs.h
+@@ -182,10 +182,10 @@
+ #define CORR_C_HELP_4		"next to each one.  You have the option of replacing the word%s\n"
+ #define CORR_C_HELP_5		"completely, or choosing one of the suggested words.%s\n"
+     /* You may add HELP_6 through HELP_9 if your language needs more lines */
+-#define CORR_C_HELP_6		""
+-#define CORR_C_HELP_7		""
+-#define CORR_C_HELP_8		""
+-#define CORR_C_HELP_9		""
++#define CORR_C_HELP_6		"%s"
++#define CORR_C_HELP_7		"%s"
++#define CORR_C_HELP_8		"%s"
++#define CORR_C_HELP_9		"%s"
+ #define CORR_C_HELP_COMMANDS	"%s\nCommands are:%s\n%s\n"
+ #define CORR_C_HELP_R_CMD	"R       Replace the misspelled word completely.%s\n"
+ #define CORR_C_HELP_BLANK	"Space   Accept the word this time only.%s\n"
+diff --git a/tree.c b/tree.c
+index 05a6918..229ae16 100644
+--- a/tree.c
++++ b/tree.c
+@@ -351,7 +351,7 @@ void treeinsert (word, wordlen, keep)
+     struct dent *	oldhtab;
+     unsigned int	oldhsize;
+     ichar_t		nword[INPUTWORDLEN + MAXAFFIXLEN];
+-    int			isvariant;
++    MASKTYPE		isvariant;
+ 
+     /*
+      * Expand hash table when it is MAXPCT % full.
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0023-Exclusive-options.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0023-Exclusive-options.patch
new file mode 100644
index 000000000000..392d94d27d33
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0023-Exclusive-options.patch
@@ -0,0 +1,38 @@
+From: Robert Luberda <robert@debian.org>
+Date: Tue, 8 Mar 2011 21:12:23 +0100
+Subject: 0023 Exclusive options
+
+Make options -x and -b mutually exclusive
+---
+ ispell.c |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/ispell.c b/ispell.c
+index d130a0e..cd5802a 100644
+--- a/ispell.c
++++ b/ispell.c
+@@ -279,6 +279,7 @@ int main (argc, argv)
+     static char	outbuf[BUFSIZ];
+     int		argno;
+     int		arglen;
++    int		bflag = 0;
+ 
+     Cmd = *argv;
+ 
+@@ -728,12 +729,13 @@ int main (argc, argv)
+ 		nodictflag++;
+ 		break;
+ 	    case 'b':
+-		if (arglen > 2)
++		if (arglen > 2 || xflag == 1)
+ 		    usage ();
+ 		xflag = 0;		/* Keep a backup file */
++		bflag = 1;
+ 		break;
+ 	    case 'x':
+-		if (arglen > 2)
++		if (arglen > 2 || bflag == 1)
+ 		    usage ();
+ 		xflag = 1;		/* Don't keep a backup file */
+ 		break;
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0024-Check-tempdir-creation.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0024-Check-tempdir-creation.patch
new file mode 100644
index 000000000000..fd35ee34ec16
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0024-Check-tempdir-creation.patch
@@ -0,0 +1,69 @@
+From: Robert Luberda <robert@debian.org>
+Date: Tue, 8 Mar 2011 21:00:31 +0100
+Subject: 0024 Check tempdir creation
+
+Fail if temporary directory cannot be created.
+---
+ findaffix.X |    3 ++-
+ munchlist.X |    3 ++-
+ subset.X    |    3 ++-
+ zapdups.X   |    3 ++-
+ 4 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/findaffix.X b/findaffix.X
+index 2c253e2..58cabab 100755
+--- a/findaffix.X
++++ b/findaffix.X
+@@ -179,7 +179,8 @@ TEMPDIR=`mktemp -d ${TDIR}/faffXXXXXXXXXX 2>/dev/null`  ||  TEMPDIR="$TDIR"
+ TMP=${TEMPDIR}/faff$$
+ if [ "$TEMPDIR" = "$TDIR" ]
+ then
+-    TOREMOVE="${TMP}*"
++    echo "Failed to create temporary directory; exiting"
++    exit 1
+ else
+     TOREMOVE="$TEMPDIR"
+ fi
+diff --git a/munchlist.X b/munchlist.X
+index ada3f1d..47bb908 100755
+--- a/munchlist.X
++++ b/munchlist.X
+@@ -180,7 +180,8 @@ MUNCHDIR=`mktemp -d ${TDIR}/munchXXXXXXXXXX 2>/dev/null`  ||  MUNCHDIR="$TDIR"
+ TMP=${MUNCHDIR}/munch$$
+ if [ "$MUNCHDIR" = "$TDIR" ]
+ then
+-    TOREMOVE="${TMP}*"
++    echo "$0: Failed to create temporary directory, exiting..."
++	exit 1
+ else
+     TOREMOVE="$MUNCHDIR"
+ fi
+diff --git a/subset.X b/subset.X
+index cc748ec..9c904cc 100755
+--- a/subset.X
++++ b/subset.X
+@@ -125,7 +125,8 @@ TEMPDIR=`mktemp -d ${TDIR}/ssetXXXXXXXXXX 2>/dev/null`  ||  TEMPDIR="$TDIR"
+ TMP=${TEMPDIR}/sset$$
+ if [ "$TEMPDIR" = "$TDIR" ]
+ then
+-    TOREMOVE="${TMP}*"
++    echo "$0: Failed to create temporary directory, exiting..."
++    exit 1
+ else
+     TOREMOVE="$TEMPDIR"
+ fi
+diff --git a/zapdups.X b/zapdups.X
+index a68852a..1c610d4 100755
+--- a/zapdups.X
++++ b/zapdups.X
+@@ -111,7 +111,8 @@ TEMPDIR=`mktemp -d ${TDIR}/zapdXXXXXXXXXX 2>/dev/null`  ||  TEMPDIR="$TDIR"
+ TMP=${TEMPDIR}/zapd$$
+ if [ "$TEMPDIR" = "$TDIR" ]
+ then
+-    TOREMOVE="${TMP}*"
++    echo "$0: Failed to create temporary directory, exiting..."
++    exit 1
+ else
+     TOREMOVE="$TEMPDIR"
+ fi
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0025-Languages.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0025-Languages.patch
new file mode 100644
index 000000000000..ffa114d28a12
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0025-Languages.patch
@@ -0,0 +1,81 @@
+From: Robert Luberda <robert@debian.org>
+Date: Tue, 8 Mar 2011 21:02:47 +0100
+Subject: 0025 Languages
+
+Fix a few words.
+---
+ languages/english/british.0 |    1 +
+ languages/english/english.0 |    8 ++++++--
+ languages/english/english.1 |    3 ++-
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/languages/english/british.0 b/languages/english/british.0
+index dc4caa7..04d9177 100644
+--- a/languages/english/british.0
++++ b/languages/english/british.0
+@@ -46,6 +46,7 @@ armour/DGMRSZ
+ armoured/U
+ armourer/MS
+ armoury/DMS
++artefact/MS
+ atomisation/MS
+ atomise/DGRSZ
+ authorisation/AMS
+diff --git a/languages/english/english.0 b/languages/english/english.0
+index fc13212..f85e15a 100644
+--- a/languages/english/english.0
++++ b/languages/english/english.0
+@@ -3502,6 +3502,7 @@ closure/DGMS
+ cloth/DGS
+ clothe/DGS
+ clothed/U
++cloths
+ cloud/DGS
+ clouded/U
+ cloudless/PY
+@@ -10019,9 +10020,10 @@ mystery/MS
+ mystic/MS
+ mystical/Y
+ mysticism/S
+-myth/MS
++myth/M
+ mythical/Y
+ mythology/MS
++myths
+ nag/MS
+ nail/DGRS
+ naive/PRY
+@@ -14818,6 +14820,7 @@ tent/DGRS
+ tentacle/DS
+ tentative/PY
+ tented/U
++tenth
+ tenths
+ tenure/DS
+ tenured/U
+@@ -16511,8 +16514,9 @@ youngster/MS
+ your/MS
+ yourself
+ yourselves
+-youth/MS
++youth/M
+ youthful/PY
++youths
+ yuck
+ Yugoslavian/MS
+ yummy/R
+diff --git a/languages/english/english.1 b/languages/english/english.1
+index 2bfac86..78a7edf 100644
+--- a/languages/english/english.1
++++ b/languages/english/english.1
+@@ -7449,7 +7449,8 @@ metalloid
+ metallurgic
+ metallurgical/Y
+ metallurgists
+-metalsmith/S
++metalsmith
++metalsmiths
+ metalwork/GJR
+ metamorphic
+ metamorphism
+-- 
diff --git a/nixpkgs/pkgs/tools/text/ispell/patches/0030-Display-whole-multibyte-character.patch b/nixpkgs/pkgs/tools/text/ispell/patches/0030-Display-whole-multibyte-character.patch
new file mode 100644
index 000000000000..bf687f04413c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ispell/patches/0030-Display-whole-multibyte-character.patch
@@ -0,0 +1,35 @@
+From: Robert Luberda <robert@debian.org>
+Date: Mon, 21 Mar 2011 10:36:15 +0100
+Subject: 0030 Display whole multibyte character
+
+Display all bytes from multibyte characters instead of converting them
+into `cat -v' format. This fixes an ugly screen content shown while
+checking UTF-8 files.
+---
+ correct.c |   11 +++++++----
+ 1 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/correct.c b/correct.c
+index 982b7c6..c91b41b 100644
+--- a/correct.c
++++ b/correct.c
+@@ -733,11 +733,14 @@ static int show_char (cp, linew, output, maxw)
+ 	ichar = SET_SIZE + laststringch;
+     else
+ 	ichar = chartoichar (ch);
+-    if (!vflag  &&  iswordch (ichar)  &&  len == 1)
++    if (!vflag  &&  iswordch (ichar)  &&  len >= 1)
+ 	{
+-	if (output)
+-	    (void) putchar (ch);
+-	(*cp)++;
++	for (i = 0; i < len; ++i)
++	    {
++		if (output)
++			(void) putchar (**cp);
++		(*cp)++;
++	    }
+ 	return 1;
+ 	}
+     if (ch == '\t')
+-- 
diff --git a/nixpkgs/pkgs/tools/text/jsawk/default.nix b/nixpkgs/pkgs/tools/text/jsawk/default.nix
new file mode 100644
index 000000000000..4f2ad403e365
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/jsawk/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, makeWrapper, spidermonkey }:
+
+stdenv.mkDerivation {
+  pname = "jsawk";
+  version = "1.5-pre";
+  src = fetchFromGitHub {
+    owner = "micha";
+    repo = "jsawk";
+    rev = "5a14c4af3c7b59807701b70a954ecefc6f77e978";
+    sha256 = "0z3vdr3c8nvdrrxkjv9b4xg47mdb2hsknxpimw6shgwbigihapyr";
+  };
+  dontBuild = true;
+  buildInputs = [ makeWrapper ];
+  installPhase = ''
+    mkdir -p $out/bin
+    cp $src/jsawk $out/bin/
+    wrapProgram $out/bin/jsawk \
+      --prefix PATH : "${spidermonkey}/bin"
+  '';
+
+  meta = {
+    description = "Jsawk is like awk, but for JSON";
+    homepage = "https://github.com/micha/jsawk";
+    license = stdenv.lib.licenses.publicDomain;
+    maintainers = with stdenv.lib.maintainers; [ puffnfresh ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/jumanpp/default.nix b/nixpkgs/pkgs/tools/text/jumanpp/default.nix
new file mode 100644
index 000000000000..ecadb4a89d8f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/jumanpp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, cmake, protobuf }:
+stdenv.mkDerivation rec {
+  pname = "jumanpp";
+  version = "2.0.0-rc2";
+
+  src = fetchurl {
+    url = "https://github.com/ku-nlp/${pname}/releases/download/v${version}/${pname}-${version}.tar.xz";
+    sha256 = "17fzmd0f5m9ayfhsr0mg7hjp3pg1mhbgknhgyd8v87x46g8bg6qp";
+  };
+  buildInputs = [ cmake protobuf ];
+
+  meta = with stdenv.lib; {
+    description = "A Japanese morphological analyser using a recurrent neural network language model (RNNLM)";
+    longDescription = ''
+      JUMAN++ is a new morphological analyser that considers semantic
+      plausibility of word sequences by using a recurrent neural network
+      language model (RNNLM).
+    '';
+    homepage = "http://nlp.ist.i.kyoto-u.ac.jp/index.php?JUMAN++";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ mt-caret ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/kakasi/default.nix b/nixpkgs/pkgs/tools/text/kakasi/default.nix
new file mode 100644
index 000000000000..626455732599
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kakasi/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, libiconv }:
+
+stdenv.mkDerivation rec {
+  name = "kakasi-2.3.6";
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin [ libiconv ];
+
+  meta = with stdenv.lib; {
+    description = "Kanji Kana Simple Inverter";
+    longDescription = ''
+      KAKASI is the language processing filter to convert Kanji
+      characters to Hiragana, Katakana or Romaji and may be
+      helpful to read Japanese documents.
+    '';
+    homepage    = "http://kakasi.namazu.org/";
+    license     = licenses.gpl2Plus;
+    platforms   = platforms.unix;
+  };
+
+  src = fetchurl {
+    url = "http://kakasi.namazu.org/stable/${name}.tar.xz";
+    sha256 = "1qry3xqb83pjgxp3my8b1sy77z4f0893h73ldrvdaky70cdppr9f";
+  };
+
+  postPatch = ''
+    for a in tests/kakasi-* ; do
+      substituteInPlace $a \
+        --replace "/bin/echo" echo
+    done
+  '';
+
+  doCheck = false; # fails 1 of 6 tests
+
+}
diff --git a/nixpkgs/pkgs/tools/text/kdiff3/default.nix b/nixpkgs/pkgs/tools/text/kdiff3/default.nix
new file mode 100644
index 000000000000..f41de9baffc0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kdiff3/default.nix
@@ -0,0 +1,27 @@
+{
+  mkDerivation, lib, fetchurl,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
+  kcrash, kconfig, kinit, kparts, kiconthemes
+}:
+
+mkDerivation rec {
+  pname = "kdiff3";
+  version = "1.8.2";
+
+  src = fetchurl {
+    url = "https://download.kde.org/stable/${pname}/${pname}-${version}.tar.xz";
+    sha256 = "0s5vsm1avzv88b6mf2pp20c2sz0srrj52iiqpnwi3p4ihivm8wgv";
+  };
+
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+
+  propagatedBuildInputs = [ kconfig kcrash kinit kparts kiconthemes ];
+
+  meta = with lib; {
+    homepage = "http://kdiff3.sourceforge.net/";
+    license = licenses.gpl2Plus;
+    description = "Compares and merges 2 or 3 files or directories";
+    maintainers = with maintainers; [ peterhoeg ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile
new file mode 100644
index 000000000000..9b3347860b65
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'kramdown-rfc2629'
diff --git a/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile.lock b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile.lock
new file mode 100644
index 000000000000..b50dc2fdbca0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/Gemfile.lock
@@ -0,0 +1,17 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    certified (1.0.0)
+    kramdown (1.17.0)
+    kramdown-rfc2629 (1.2.13)
+      certified (~> 1.0)
+      kramdown (~> 1.17.0)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  kramdown-rfc2629
+
+BUNDLED WITH
+   2.1.4
diff --git a/nixpkgs/pkgs/tools/text/kramdown-rfc2629/default.nix b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/default.nix
new file mode 100644
index 000000000000..945c676ca18d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/default.nix
@@ -0,0 +1,18 @@
+{ lib, bundlerApp }:
+
+# Not in the default ../../../development/ruby-modules/with-packages/Gemfile
+# because of version clash on the "kramdown" dependency.
+bundlerApp rec {
+  pname = "kramdown-rfc2629";
+  gemdir = ./.;
+  exes = [ "kramdown-rfc2629" ];
+
+  meta = with lib; {
+    description = "A markdown parser with multiple backends";
+    homepage    = "https://github.com/cabo/kramdown-rfc2629";
+    license     = with licenses; mit;
+    maintainers = with maintainers; [
+      vcunat # not really, but I expect to use it occasionally around IETF
+    ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/kramdown-rfc2629/gemset.nix b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/gemset.nix
new file mode 100644
index 000000000000..65d1c234de25
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kramdown-rfc2629/gemset.nix
@@ -0,0 +1,33 @@
+{
+  certified = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1706p6p0a8adyvd943af2a3093xakvislgffw3v9dvp7j07dyk5a";
+      type = "gem";
+    };
+    version = "1.0.0";
+  };
+  kramdown = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1n1c4jmrh5ig8iv1rw81s4mw4xsp4v97hvf8zkigv4hn5h542qjq";
+      type = "gem";
+    };
+    version = "1.17.0";
+  };
+  kramdown-rfc2629 = {
+    dependencies = ["certified" "kramdown"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0s53m46qlcdakik0czvx0p41mk46l9l36331cps8gpf364wf3l9d";
+      type = "gem";
+    };
+    version = "1.2.13";
+  };
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/tools/text/kytea/default.nix b/nixpkgs/pkgs/tools/text/kytea/default.nix
new file mode 100644
index 000000000000..b120d43287a5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kytea/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+
+  pname = "kytea";
+  version = "0.4.7";
+
+  src = fetchurl {
+    url    = "http://www.phontron.com/kytea/download/${pname}-${version}.tar.gz";
+    sha256 = "0ilzzwn5vpvm65bnbyb9f5rxyxy3jmbafw9w0lgl5iad1ka36jjk";
+  };
+
+  patches = [ ./gcc-O3.patch ];
+
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
+
+  meta = with stdenv.lib; {
+    homepage = "http://www.phontron.com/kytea/";
+    description = "General toolkit developed for analyzing text";
+
+    longDescription = ''
+      A general toolkit developed for analyzing text, with a focus on Japanese,
+      Chinese and other languages requiring word or morpheme segmentation.
+    '';
+
+    license = licenses.asl20;
+
+    maintainers = with maintainers; [ ericsagnes ];
+    platforms = platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/text/kytea/gcc-O3.patch b/nixpkgs/pkgs/tools/text/kytea/gcc-O3.patch
new file mode 100644
index 000000000000..71b1d0c3b16e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/kytea/gcc-O3.patch
@@ -0,0 +1,13 @@
+diff --git a/src/lib/kytea-util.cpp b/src/lib/kytea-util.cpp
+index 7c8c4c6..4492df1 100644
+--- a/src/lib/kytea-util.cpp
++++ b/src/lib/kytea-util.cpp
+@@ -49,5 +49,8 @@ void checkValueVecEqual(const std::vector<T> * a, const std::vector<T> * b) {
+ 
++template void checkValueVecEqual(const std::vector<unsigned int> & a, const std::vector<unsigned int> & b);
+ template void checkValueVecEqual(const std::vector<unsigned int> * a, const std::vector<unsigned int> * b);
++template void checkValueVecEqual(const std::vector<short> & a, const std::vector<short> & b);
+ template void checkValueVecEqual(const std::vector<short> * a, const std::vector<short> * b);
+ template void checkValueVecEqual(const std::vector<vector<KyteaString> > * a, const std::vector<vector<KyteaString> > * b);
++template void checkValueVecEqual(const std::vector<int> & a, const std::vector<int> & b);
+ template void checkValueVecEqual(const std::vector<int> * a, const std::vector<int> * b);
diff --git a/nixpkgs/pkgs/tools/text/languagetool/default.nix b/nixpkgs/pkgs/tools/text/languagetool/default.nix
new file mode 100644
index 000000000000..154e099d3dd2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/languagetool/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchzip, jre, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "LanguageTool";
+  version = "4.9";
+
+  src = fetchzip {
+    url = "https://www.languagetool.org/download/${pname}-${version}.zip";
+    sha256 = "05jqqamdvi5x35yy9bqw6wf7qagrm1r9488f7cfbbv764zfirz17";
+  };
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ jre ];
+
+  installPhase = ''
+    mkdir -p $out/share
+    mv * $out/share/
+
+    for lt in languagetool{,-commandline,-server};do
+      makeWrapper ${jre}/bin/java $out/bin/$lt \
+        --add-flags "-cp $out/share/ -jar $out/share/$lt.jar"
+    done
+
+    makeWrapper ${jre}/bin/java $out/bin/languagetool-http-server \
+      --add-flags "-cp $out/share/languagetool-server.jar org.languagetool.server.HTTPServer"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://languagetool.org";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [
+      edwtjo
+    ];
+    description = "A proofreading program for English, French German, Polish, and more";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/link-grammar/default.nix b/nixpkgs/pkgs/tools/text/link-grammar/default.nix
new file mode 100644
index 000000000000..25a5d129c81b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/link-grammar/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, python3, sqlite, libedit, zlib }:
+
+stdenv.mkDerivation rec {
+  version = "5.8.0";
+  pname = "link-grammar";
+
+  outputs = [ "bin" "out" "dev" "man" ];
+
+  src = fetchurl {
+    url = "http://www.abisource.com/downloads/${pname}/${version}/${pname}-${version}.tar.gz";
+    sha256 = "1v8ngx77nachxln68xpvyw2lh7z59pzsi99h8j0mnrm0gjsacrdd";
+  };
+
+  nativeBuildInputs = [ pkgconfig python3 ];
+  buildInputs = [ sqlite libedit zlib ];
+
+  configureFlags = [
+    "--disable-java-bindings"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A Grammar Checking library";
+    homepage = "https://www.abisource.com/projects/link-grammar/";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/lv/default.nix b/nixpkgs/pkgs/tools/text/lv/default.nix
new file mode 100644
index 000000000000..3e96858f9c9c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/lv/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+  pname = "lv";
+  version = "4.51";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/l/${pname}/${pname}_${version}.orig.tar.gz";
+    sha256 = "0yf3idz1qspyff1if41xjpqqcaqa8q8icslqlnz0p9dj36gmm5l3";
+  };
+
+  makeFlags = [ "prefix=${placeholder "out"}" ];
+
+  buildInputs = [ ncurses ];
+
+  configurePhase = ''
+    mkdir -p build
+    cd build
+    ../src/configure
+  '';
+
+  preInstall = ''
+    mkdir -p $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Powerful multi-lingual file viewer / grep";
+    homepage = "https://web.archive.org/web/20160310122517/www.ff.iij4u.or.jp/~nrt/lv/";
+    license = licenses.gpl2;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [ kayhide ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mairix/default.nix b/nixpkgs/pkgs/tools/text/mairix/default.nix
new file mode 100644
index 000000000000..a2ae91e974b0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mairix/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, zlib, bzip2, bison, flex }:
+
+stdenv.mkDerivation rec {
+  name = "mairix-0.24";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/mairix/${name}.tar.gz";
+    sha256 = "0msaxz5c5hf7k1ci16i67m4ynrbrpsxbqzk84nz6z2vnkh3jww50";
+  };
+
+  buildInputs = [ zlib bzip2 bison flex ];
+
+  # https://github.com/rc0/mairix/pull/19
+  patches = [ ./mmap.patch ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = "http://www.rc0.org.uk/mairix";
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "Program for indexing and searching email messages stored in maildir, MH or mbox";
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mairix/mmap.patch b/nixpkgs/pkgs/tools/text/mairix/mmap.patch
new file mode 100644
index 000000000000..241083f2dde5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mairix/mmap.patch
@@ -0,0 +1,161 @@
+Making mairix work with mbox files over 2GB.
+
+https://github.com/rc0/mairix/pull/19
+
+diff --git a/mairix.h b/mairix.h
+index 2480492..cb25824 100644
+--- a/mairix.h
++++ b/mairix.h
+@@ -327,9 +327,9 @@ enum data_to_rfc822_error {
+   DTR8_BAD_HEADERS, /* corrupt headers */
+   DTR8_BAD_ATTACHMENT /* corrupt attachment (e.g. no body part) */
+ };
+-struct rfc822 *data_to_rfc822(struct msg_src *src, char *data, int length, enum data_to_rfc822_error *error);
+-void create_ro_mapping(const char *filename, unsigned char **data, int *len);
+-void free_ro_mapping(unsigned char *data, int len);
++struct rfc822 *data_to_rfc822(struct msg_src *src, char *data, size_t length, enum data_to_rfc822_error *error);
++void create_ro_mapping(const char *filename, unsigned char **data, size_t *len);
++void free_ro_mapping(unsigned char *data, size_t len);
+ char *format_msg_src(struct msg_src *src);
+ 
+ /* In tok.c */
+diff --git a/mbox.c b/mbox.c
+index ebbfa78..396e27d 100644
+--- a/mbox.c
++++ b/mbox.c
+@@ -816,7 +816,7 @@ void build_mbox_lists(struct database *db, const char *folder_base, /*{{{*/
+         mb->n_old_msgs_valid = mb->n_msgs;
+       } else {
+         unsigned char *va;
+-        int len;
++        size_t len;
+         create_ro_mapping(mb->path, &va, &len);
+         if (va) {
+           rescan_mbox(mb, (char *) va, len);
+@@ -852,7 +852,7 @@ int add_mbox_messages(struct database *db)/*{{{*/
+   int any_new = 0;
+   int N;
+   unsigned char *va;
+-  int valen;
++  size_t valen;
+   enum data_to_rfc822_error error;
+ 
+   for (i=0; i<db->n_mboxen; i++) {
+diff --git a/reader.c b/reader.c
+index 71ac5bd..18f0108 100644
+--- a/reader.c
++++ b/reader.c
+@@ -81,7 +81,8 @@ static void read_toktable2_db(char *data, struct toktable2_db *toktable, int sta
+ /*}}}*/
+ struct read_db *open_db(char *filename)/*{{{*/
+ {
+-  int fd, len;
++  int fd;
++  size_t len;
+   char *data;
+   struct stat sb;
+   struct read_db *result;
+diff --git a/reader.h b/reader.h
+index 9b5dfa3..d709cc4 100644
+--- a/reader.h
++++ b/reader.h
+@@ -138,7 +138,7 @@ struct toktable2_db {/*{{{*/
+ struct read_db {/*{{{*/
+   /* Raw file parameters, needed later for munmap */
+   char *data;
+-  int len;
++  size_t len;
+ 
+   /* Pathname information */
+   int n_msgs;
+diff --git a/rfc822.c b/rfc822.c
+index b411f85..9c8e1a4 100644
+--- a/rfc822.c
++++ b/rfc822.c
+@@ -990,7 +990,7 @@ static void scan_status_flags(const char *s, struct headers *hdrs)/*{{{*/
+ 
+ /*{{{ data_to_rfc822() */
+ struct rfc822 *data_to_rfc822(struct msg_src *src,
+-    char *data, int length,
++    char *data, size_t length,
+     enum data_to_rfc822_error *error)
+ {
+   struct rfc822 *result;
+@@ -1265,7 +1265,7 @@ static struct ro_mapping *add_ro_cache(const char *filename, int fd, size_t len)
+ }
+ #endif /* USE_GZIP_MBOX || USE_BZIP_MBOX */
+ 
+-void create_ro_mapping(const char *filename, unsigned char **data, int *len)/*{{{*/
++void create_ro_mapping(const char *filename, unsigned char **data, size_t *len)/*{{{*/
+ {
+   struct stat sb;
+   int fd;
+@@ -1386,7 +1386,7 @@ comp_error:
+   data_alloc_type = ALLOC_MMAP;
+ }
+ /*}}}*/
+-void free_ro_mapping(unsigned char *data, int len)/*{{{*/
++void free_ro_mapping(unsigned char *data, size_t len)/*{{{*/
+ {
+   int r;
+ 
+@@ -1414,7 +1414,7 @@ static struct msg_src *setup_msg_src(char *filename)/*{{{*/
+ /*}}}*/
+ struct rfc822 *make_rfc822(char *filename)/*{{{*/
+ {
+-  int len;
++  size_t len;
+   unsigned char *data;
+   struct rfc822 *result;
+ 
+diff --git a/search.c b/search.c
+index 18b51ee..97967bc 100644
+--- a/search.c
++++ b/search.c
+@@ -681,7 +681,7 @@ static void mbox_terminate(const unsigned char *data, int len, FILE *out)/*{{{*/
+ static void append_file_to_mbox(const char *path, FILE *out)/*{{{*/
+ {
+   unsigned char *data;
+-  int len;
++  size_t len;
+   create_ro_mapping(path, &data, &len);
+   if (data) {
+     fprintf(out, "From mairix@mairix Mon Jan  1 12:34:56 1970\n");
+@@ -698,8 +698,8 @@ static int had_failed_checksum;
+ 
+ static void get_validated_mbox_msg(struct read_db *db, int msg_index,/*{{{*/
+                                    int *mbox_index,
+-                                   unsigned char **mbox_data, int *mbox_len,
+-                                   unsigned char **msg_data,  int *msg_len)
++                                   unsigned char **mbox_data, size_t *mbox_len,
++                                   unsigned char **msg_data,  size_t *msg_len)
+ {
+   /* msg_data==NULL if checksum mismatches */
+   unsigned char *start;
+@@ -738,7 +738,7 @@ static void append_mboxmsg_to_mbox(struct read_db *db, int msg_index, FILE *out)
+ {
+   /* Need to common up code with try_copy_to_path */
+   unsigned char *mbox_start, *msg_start;
+-  int mbox_len, msg_len;
++  size_t mbox_len, msg_len;
+   int mbox_index;
+ 
+   get_validated_mbox_msg(db, msg_index, &mbox_index, &mbox_start, &mbox_len, &msg_start, &msg_len);
+@@ -759,7 +759,7 @@ static void append_mboxmsg_to_mbox(struct read_db *db, int msg_index, FILE *out)
+ static void try_copy_to_path(struct read_db *db, int msg_index, char *target_path)/*{{{*/
+ {
+   unsigned char *data;
+-  int mbox_len, msg_len;
++  size_t mbox_len, msg_len;
+   int mbi;
+   FILE *out;
+   unsigned char *start;
+@@ -1214,7 +1214,7 @@ static int do_search(struct read_db *db, char **args, char *output_path, int sho
+                 unsigned int mbix, msgix;
+                 int start, len, after_end;
+                 unsigned char *mbox_start, *msg_start;
+-                int mbox_len, msg_len;
++                size_t mbox_len, msg_len;
+                 int mbox_index;
+ 
+                 start = db->mtime_table[i];
diff --git a/nixpkgs/pkgs/tools/text/markdown-pp/default.nix b/nixpkgs/pkgs/tools/text/markdown-pp/default.nix
new file mode 100644
index 000000000000..eaaa0547964d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/markdown-pp/default.nix
@@ -0,0 +1,24 @@
+{ fetchFromGitHub, pythonPackages, stdenv }:
+
+with pythonPackages;
+buildPythonApplication rec {
+  pname = "MarkdownPP";
+  version = "1.5.1";
+  propagatedBuildInputs = [ pillow watchdog ];
+  checkPhase = ''
+    cd test
+    PATH=$out/bin:$PATH ${python}/bin/${python.executable} test.py
+  '';
+  src = fetchFromGitHub {
+    owner = "jreese";
+    repo = "markdown-pp";
+    rev = "v${version}";
+    sha256 = "180i5wn9z6vdk2k2bh8345z3g80hj7zf5s2pq0h7k9vaxqpp7avc";
+  };
+  meta = with stdenv.lib; {
+    description = "Preprocessor for Markdown files to generate a table of contents and other documentation needs";
+    license = licenses.mit;
+    homepage = "https://github.com/jreese/markdown-pp";
+    maintainers = with maintainers; [ zgrannan ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mawk/default.nix b/nixpkgs/pkgs/tools/text/mawk/default.nix
new file mode 100644
index 000000000000..204d346082c3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mawk/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "mawk-1.3.4-20200120";
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.invisible-island.net/mawk/${name}.tgz"
+      "https://invisible-mirror.net/archives/mawk/${name}.tgz"
+    ];
+    sha256 = "0dw2icf8bnqd9y0clfd9pkcxz4b2phdihwci13z914mf3wgcvm3z";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Interpreter for the AWK Programming Language";
+    homepage = "https://invisible-island.net/mawk/mawk.html";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ehmry ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mb2md/default.nix b/nixpkgs/pkgs/tools/text/mb2md/default.nix
new file mode 100644
index 000000000000..91c958cf0675
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mb2md/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, makeWrapper, perlPackages }:
+
+let
+  perlDeps = with perlPackages; [ TimeDate ];
+in
+stdenv.mkDerivation rec {
+  version = "3.20";
+  pname = "mb2md";
+
+  src = fetchurl {
+    url = "http://batleth.sapienti-sat.org/projects/mb2md/mb2md-${version}.pl.gz";
+    sha256 = "0bvkky3c90738h3skd2f1b2yy5xzhl25cbh9w2dy97rs86ssjidg";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perlPackages.perl ];
+
+  unpackPhase = ''
+    sourceRoot=.
+    gzip -d < $src > mb2md.pl
+  '';
+
+  installPhase = ''
+    install -D $sourceRoot/mb2md.pl $out/bin/mb2md
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/mb2md \
+      --set PERL5LIB "${perlPackages.makePerlPath perlDeps}"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "mbox to maildir tool";
+    license = licenses.publicDomain;
+    platforms = platforms.all;
+    maintainers = [ maintainers.jb55 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mdbook/default.nix b/nixpkgs/pkgs/tools/text/mdbook/default.nix
new file mode 100644
index 000000000000..9ca92a21db1c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mdbook/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, rustPlatform, CoreServices, darwin }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "mdbook";
+  version = "0.3.7";
+
+  src = fetchFromGitHub {
+    owner = "rust-lang-nursery";
+    repo = "mdBook";
+    rev = "v${version}";
+    sha256 = "0a5i842aqa5xaii5lfrnks0ldavbhbd3bl4f2d442i1ahbin5b32";
+  };
+
+  cargoSha256 = "1qx3447y684b7y18lgk9cc37if2ld42jnmy1kak191q6rjh5ssh7";
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ CoreServices ];
+
+  meta = with stdenv.lib; {
+    description = "Create books from MarkDown";
+    homepage = "https://github.com/rust-lang-nursery/mdbook";
+    license = [ licenses.mpl20 ];
+    maintainers = [ maintainers.havvy ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mdcat/default.nix b/nixpkgs/pkgs/tools/text/mdcat/default.nix
new file mode 100644
index 000000000000..afd1a2990ff4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mdcat/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl, Security, ansi2html }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "mdcat";
+  version = "0.16.0";
+
+  src = fetchFromGitHub {
+    owner = "lunaryorn";
+    repo = pname;
+    rev = "mdcat-${version}";
+    sha256 = "10svzq7656lynfcgnbyaibfvv48i4289ymxfc0bn0212biyrl1zb";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ openssl ] ++ stdenv.lib.optional stdenv.isDarwin Security;
+
+  cargoSha256 = "05nh3dfr7mdw21sdavyyjhr8sa4jcfqzwizbgg92ib7r834ir3m0";
+
+  checkInputs = [ ansi2html ];
+  checkPhase = ''
+    # Skip tests that use the network and that include files.
+    cargo test -- --skip terminal::iterm2 \
+      --skip magic::tests::detect_mimetype_of_svg_image \
+      --skip magic::tests::detect_mimetype_of_png_image \
+      --skip resources::tests::read_url_with_http_url_fails_when_status_404 \
+      --skip resources::tests::read_url_with_http_url_returns_content_when_status_200
+  '';
+
+  meta = with stdenv.lib; {
+    description = "cat for markdown";
+    homepage = "https://github.com/lunaryorn/mdcat";
+    license = with licenses; [ asl20 ];
+    maintainers = with maintainers; [ davidtwco ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mecab/base.nix b/nixpkgs/pkgs/tools/text/mecab/base.nix
new file mode 100644
index 000000000000..181eb405cbd7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mecab/base.nix
@@ -0,0 +1,16 @@
+{ fetchurl }:
+
+{
+    version = "0.996";
+
+    src = fetchurl {
+      url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE";
+      name = "mecab-0.996.tar.gz";
+      sha256 = "0ncwlqxl1hdn1x4v4kr2sn1sbbcgnhdphp0lcvk74nqkhdbk4wz0";
+    };
+
+    buildPhase = ''
+      make
+      make check
+    '';
+}
diff --git a/nixpkgs/pkgs/tools/text/mecab/default.nix b/nixpkgs/pkgs/tools/text/mecab/default.nix
new file mode 100644
index 000000000000..32060a6179a2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mecab/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, mecab-ipadic }:
+
+let
+  mecab-base = import ./base.nix { inherit fetchurl; };
+in
+stdenv.mkDerivation (mecab-base // {
+    name = "mecab-${mecab-base.version}";
+
+    postInstall = ''
+      sed -i 's|^dicdir = .*$|dicdir = ${mecab-ipadic}|' "$out/etc/mecabrc"
+    '';
+
+    meta = with stdenv.lib; {
+      description = "Japanese morphological analysis system";
+      homepage = "http://taku910.github.io/mecab/";
+      license = licenses.bsd3;
+      platforms = platforms.unix;
+      maintainers = with maintainers; [ auntie ];
+    };
+})
diff --git a/nixpkgs/pkgs/tools/text/mecab/ipadic.nix b/nixpkgs/pkgs/tools/text/mecab/ipadic.nix
new file mode 100644
index 000000000000..026e385e7c2b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mecab/ipadic.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl, mecab-nodic }:
+
+stdenv.mkDerivation {
+  pname = "mecab-ipadic";
+  version = "2.7.0-20070801";
+
+  src = fetchurl {
+    url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM";
+    name = "mecab-ipadic-2.7.0-20070801.tar.gz";
+    sha256 = "08rmkvj0f0x6jq0axrjw2y5nam0mavv6x77dp9v4al0wi1ym4bxn";
+  };
+
+  buildInputs = [ mecab-nodic ];
+
+  configurePhase = ''
+    ./configure --with-dicdir="$out"
+  '';
+}
diff --git a/nixpkgs/pkgs/tools/text/mecab/nodic.nix b/nixpkgs/pkgs/tools/text/mecab/nodic.nix
new file mode 100644
index 000000000000..1cbc31be4ee1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mecab/nodic.nix
@@ -0,0 +1,8 @@
+{ stdenv, fetchurl }:
+
+let
+  mecab-base = import ./base.nix { inherit fetchurl; };
+in
+stdenv.mkDerivation (mecab-base // {
+    name = "mecab-nodic-${mecab-base.version}";
+})
diff --git a/nixpkgs/pkgs/tools/text/miller/default.nix b/nixpkgs/pkgs/tools/text/miller/default.nix
new file mode 100644
index 000000000000..3b8fbdb64298
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/miller/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, flex, libtool }:
+
+stdenv.mkDerivation rec {
+  pname = "miller";
+
+  version = "5.7.0";
+
+  src = fetchFromGitHub {
+    owner = "johnkerl";
+    repo = "miller";
+    rev = "v${version}";
+    sha256 = "1lmin69rf9lp3b64ga7li4sz7mm0gqapsbk1nb29l4fqjxk16ddh";
+  };
+
+  nativeBuildInputs = [ autoreconfHook flex libtool ];
+
+  meta = with stdenv.lib; {
+    description = "Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON.";
+    homepage    = "http://johnkerl.org/miller/";
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ mstarzyk ];
+    platforms   = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mir-qualia/default.nix b/nixpkgs/pkgs/tools/text/mir-qualia/default.nix
new file mode 100644
index 000000000000..f532daf8c442
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mir-qualia/default.nix
@@ -0,0 +1,21 @@
+{ lib, pythonPackages, fetchurl }:
+
+pythonPackages.buildPythonApplication rec {
+  pname = "mir.qualia";
+  version = "2.0.0";
+  doCheck = false; # 2.0.0-released pytests are broken
+
+  buildInputs = with pythonPackages; [ pytest ];
+
+  src = fetchurl {
+    url = "mirror://pypi/m/mir.qualia/mir.qualia-${version}.tar.gz";
+    sha256 = "1ybq6jb5clh9hw0sp3idp4hjv2gkm9yiaph48gcc208affflc8m9";
+  };
+
+  meta = {
+    description = "Dynamically enable sections of config files";
+    homepage = "https://github.com/darkfeline/mir.qualia";
+    license = lib.licenses.asl20;
+    maintainers = [ lib.maintainers.srhb ] ;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/mpage/default.nix b/nixpkgs/pkgs/tools/text/mpage/default.nix
new file mode 100644
index 000000000000..e86c9f2ad266
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/mpage/default.nix
@@ -0,0 +1,29 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "mpage-2.5.7";
+  src = fetchurl {
+    url = "http://www.mesa.nl/pub/mpage/${name}.tgz";
+    sha256 = "1zn37r5xrvjgjbw2bdkc0r7s6q8b1krmcryzj0yf0dyxbx79rasi";
+  };
+
+  patchPhase = ''
+    sed -i "Makefile" -e "s|^ *PREFIX *=.*$|PREFIX = $out|g"
+  '';
+
+  meta = {
+    description = "Many-to-one page printing utility";
+
+    longDescription = ''
+      Mpage reads plain text files or PostScript documents and prints
+      them on a PostScript printer with the text reduced in size so
+      that several pages appear on one sheet of paper.  This is useful
+      for viewing large printouts on a small amount of paper.  It uses
+      ISO 8859.1 to print 8-bit characters.
+    '';
+
+    license = "liberal";  # a non-copyleft license, see `Copyright' file
+    homepage = "http://www.mesa.nl/pub/mpage/";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/data/default.nix b/nixpkgs/pkgs/tools/text/multitran/data/default.nix
new file mode 100644
index 000000000000..9b431f5b30bd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/data/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl} :
+
+# This package requires a locale ru_RU.cp1251 locale entry.
+# Waiting for a better idea, I created it modifying a store file using:
+#   localedef -f CP1251 -i ru_RU ru_RU.CP1251
+# The store file mentioned is in "${glibc.out}/lib/locale/locale-archive"
+
+stdenv.mkDerivation {
+  name = "multitran-data-0.3";
+  src = fetchurl {
+      url = "mirror://sourceforge/multitran/multitran-data.tar.bz2";
+      sha256 = "9c2ff5027c2fe72b0cdf056311cd7543f447feb02b455982f20d4a3966b7828c";
+  };
+
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' Makefile
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran data english-russian";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/libbtree/default.nix b/nixpkgs/pkgs/tools/text/multitran/libbtree/default.nix
new file mode 100644
index 000000000000..9a7e0fdbd07f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/libbtree/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation {
+  name = "libbtree-0.0.1alpha2";
+  src = fetchurl {
+    url = "mirror://sourceforge/multitran/libbtree-0.0.1alpha2.tar.bz2";
+    sha256 = "34a584e45058950337ff9342693b6739b52c3ce17e66440526c4bd6f9575802c";
+  };
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' src/Makefile;
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran lib: library for reading Multitran's BTREE database format";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/libfacet/default.nix b/nixpkgs/pkgs/tools/text/multitran/libfacet/default.nix
new file mode 100644
index 000000000000..f359819aa736
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/libfacet/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, libmtsupport }:
+
+stdenv.mkDerivation {
+  name = "libfacet-0.0.1alpha2";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/multitran/libfacet-0.0.1alpha2.tar.bz2";
+    sha256 = "dc53351c4035a3c27dc6c1d0410e808346fbc107e7e7c112ec65c59d0df7a144";
+  };
+
+  buildInputs = [ libmtsupport ];
+
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' \
+      -e 's@/usr/include/mt/support@${libmtsupport}/include/mt/support@' \
+      src/Makefile;
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran lib: enchanced locale facets";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/libmtquery/default.nix b/nixpkgs/pkgs/tools/text/multitran/libmtquery/default.nix
new file mode 100644
index 000000000000..2c03de6ede89
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/libmtquery/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchurl, libmtsupport, libfacet, libbtree, multitrandata } :
+
+stdenv.mkDerivation {
+  name = "libmtquery-0.0.1alpha3";
+  src = fetchurl {
+    url = "mirror://sourceforge/multitran/libmtquery-0.0.1alpha3.tar.bz2";
+    sha256 = "e24c7c15772445f1b14871928d84dd03cf93bd88f9d2b2ed1bf0257c2cf2b15e";
+  };
+
+  buildInputs = [ libmtsupport libfacet libbtree multitrandata ];
+
+  NIX_LDFLAGS = "-lbtree";
+
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' \
+      -e 's@/usr/include/mt/support@${libmtsupport}/include/mt/support@' \
+      -e 's@/usr/include/btree@${libbtree}/include/btree@' \
+      -e 's@/usr/include/facet@${libfacet}/include/facet@' \
+      src/Makefile testsuite/Makefile;
+    sed -i -e 's@/usr/share/multitran@${multitrandata}/share/multitran@' src/config.cc
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran lib: main engine to query translations";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/libmtsupport/default.nix b/nixpkgs/pkgs/tools/text/multitran/libmtsupport/default.nix
new file mode 100644
index 000000000000..bc5a77be4fb9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/libmtsupport/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation {
+  name = "libmtsupport-0.0.1alpha2";
+  src = fetchurl {
+    url = "mirror://sourceforge/multitran/libmtsupport-0.0.1alpha2.tar.bz2";
+    sha256 = "481f0f1ec15d7274f1e4eb93e7d060df10a181efd037eeff5e8056d283a9298b";
+  };
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' src/Makefile;
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran lib: basic useful functions";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/multitran/mtutils/default.nix b/nixpkgs/pkgs/tools/text/multitran/mtutils/default.nix
new file mode 100644
index 000000000000..9d701421d11c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/multitran/mtutils/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, libmtsupport, libfacet, libbtree, libmtquery, help2man} :
+
+stdenv.mkDerivation {
+  name = "mt-utils-0.0.1alpha3";
+  src = fetchurl {
+      url = "mirror://sourceforge/multitran/mt-utils-0.0.1alpha3.tar.bz2";
+      sha256 = "e407702c90c5272882386914e1eeca5f6c5039393af9a44538536b94867b0a0e";
+  };
+
+  buildInputs = [ libmtsupport libfacet libbtree libmtquery help2man ];
+
+  patchPhase = ''
+    sed -i -e 's@\$(DESTDIR)/usr@'$out'@' \
+      -e 's@/usr/include/mt/support@${libmtsupport}/include/mt/support@' \
+      -e 's@/usr/include/btree@${libbtree}/include/btree@' \
+      -e 's@/usr/include/facet@${libfacet}/include/facet@' \
+      -e 's@/usr/include/mt/query@${libmtquery}/include/mt/query@' \
+      -e 's@-lmtquery@-lmtquery -lmtsupport -lfacet@' \
+      src/Makefile;
+    # Fixing multibyte locale output
+    sed -i -e 's@message.length()@message.length()*5@' \
+      src/converter.cc;
+  '';
+
+  meta = {
+    homepage = "http://multitran.sourceforge.net/";
+    description = "Multitran: simple command line utilities for dictionary maintenance";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/namazu/default.nix b/nixpkgs/pkgs/tools/text/namazu/default.nix
new file mode 100644
index 000000000000..93fc9dc75de7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/namazu/default.nix
@@ -0,0 +1,44 @@
+{ fetchurl, stdenv, perl }:
+
+stdenv.mkDerivation rec {
+  name = "namazu-2.0.21";
+
+  src = fetchurl {
+    url = "http://namazu.org/stable/${name}.tar.gz";
+    sha256 = "1xvi7hrprdchdpzhg3fvk4yifaakzgydza5c0m50h1yvg6vay62w";
+  };
+
+  buildInputs = [ perl ];
+
+  # First install the `File::MMagic' Perl module.
+  preConfigure = ''
+    ( cd File-MMagic &&                              \
+      perl Makefile.PL                               \
+        LIB="$out/${perl.libPrefix}/${perl.version}" \
+        INSTALLSITEMAN3DIR="$out/man" &&             \
+      make && make install )
+    export PERL5LIB="$out/${perl.libPrefix}/${perl.version}:$PERL5LIB"
+  '';
+
+  # FIXME: The `tests/namazu-6' test fails on GNU/Linux, presumably because
+  # phrase searching is broken somehow.  However, it doesn't fail on other
+  # platforms.
+  doCheck = !stdenv.isLinux;
+
+  meta = {
+    description = "Full-text search engine";
+
+    longDescription = ''
+      Namazu is a full-text search engine intended for easy use.  Not
+      only does it work as a small or medium scale Web search engine,
+      but also as a personal search system for email or other files.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+    homepage = "http://namazu.org/";
+
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+    maintainers = [ ];
+    broken = true; # File-MMagic is not compatible with our Perl version
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/nawk/default.nix b/nixpkgs/pkgs/tools/text/nawk/default.nix
new file mode 100644
index 000000000000..57f036a47f0d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/nawk/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, yacc }:
+
+stdenv.mkDerivation rec {
+  name = "nawk-20121220";
+
+  src = fetchurl {
+    url = "https://www.cs.princeton.edu/~bwk/btl.mirror/awk.tar.gz";
+    sha256 = "10wvdn7xwc5bbp5h7l0b9fxby3bds21n8a34z54i8kjsbhb95h4d";
+  };
+
+  nativeBuildInputs = [ yacc ];
+
+  unpackPhase = ''
+    mkdir build
+    cd build
+    tar xvf ${src}
+  '';
+
+  patchPhase = ''
+    substituteInPlace ./makefile \
+    --replace "YACC = yacc -d -S" ""
+  '';
+
+  installPhase = ''
+    install -Dm755 a.out "$out/bin/nawk"
+    install -Dm644 awk.1 "$out/share/man/man1/nawk.1"
+  '';
+
+  meta = {
+    description = "The one, true implementation of AWK";
+    longDescription = ''
+       This is the version of awk described in "The AWK Programming
+       Language", by Al Aho, Brian Kernighan, and Peter Weinberger
+       (Addison-Wesley, 1988, ISBN 0-201-07981-X).
+    '';
+    homepage = "https://www.cs.princeton.edu/~bwk/btl.mirror/";
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.konimex ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/nkf/default.nix b/nixpkgs/pkgs/tools/text/nkf/default.nix
new file mode 100644
index 000000000000..8a314d448439
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/nkf/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "nkf";
+  version = "2.1.5";
+
+  src = fetchurl {
+    url = "mirror://osdn/nkf/70406/${pname}-${version}.tar.gz";
+    sha256 = "0i5dbcb9aipwr8ym4mhvgf1in3frl6y8h8x96cprz9s7b11xz9yi";
+  };
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  meta = {
+    description = "Tool for converting encoding of Japanese text";
+    homepage = "https://nkf.osdn.jp/";
+    license = stdenv.lib.licenses.zlib;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.auntie ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/numdiff/default.nix b/nixpkgs/pkgs/tools/text/numdiff/default.nix
new file mode 100644
index 000000000000..6e0c7e756493
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/numdiff/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl }:
+
+
+stdenv.mkDerivation rec {
+  pname = "numdiff";
+  version = "5.9.0";
+
+  src = fetchurl {
+    url = "mirror://savannah/numdiff/numdiff-${version}.tar.gz";
+    sha256 = "1vzmjh8mhwwysn4x4m2vif7q2k8i19x8azq7pzmkwwj4g48lla47";
+  };
+  meta = with stdenv.lib; {
+    description = ''
+      A little program that can be used to compare putatively similar files
+      line by line and field by field, ignoring small numeric differences
+      or/and different numeric formats
+    '';
+    homepage = "https://www.nongnu.org/numdiff/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [];
+    platforms = platforms.gnu ++ platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ocrmypdf/default.nix b/nixpkgs/pkgs/tools/text/ocrmypdf/default.nix
new file mode 100644
index 000000000000..83d0bdd92c74
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ocrmypdf/default.nix
@@ -0,0 +1,107 @@
+{ fetchFromGitHub
+, ghostscript
+, img2pdf
+, jbig2enc
+, leptonica
+, pngquant
+, python3
+, python3Packages
+, qpdf
+, stdenv
+, tesseract4
+, unpaper
+, substituteAll
+}:
+
+let
+  inherit (python3Packages) buildPythonApplication;
+
+  runtimeDeps = with python3Packages; [
+    ghostscript
+    jbig2enc
+    leptonica
+    pngquant
+    qpdf
+    tesseract4
+    unpaper
+    pillow
+  ];
+
+in buildPythonApplication rec {
+  pname = "ocrmypdf";
+  version = "9.6.1";
+  disabled = ! python3Packages.isPy3k;
+
+  src = fetchFromGitHub {
+    owner = "jbarlow83";
+    repo = "OCRmyPDF";
+    rev = "v${version}";
+    sha256 = "0lbld11r8zds79183hh5y2f5fi7cacl7bx9f7f2g58j38y1c65vj";
+  };
+
+  nativeBuildInputs = with python3Packages; [
+    pytestrunner
+    setuptools
+    setuptools-scm-git-archive
+    setuptools_scm
+  ];
+
+  propagatedBuildInputs = with python3Packages; [
+    cffi
+    chardet
+    img2pdf
+    pdfminer
+    pikepdf
+    pillow
+    reportlab
+    setuptools
+    tqdm
+  ];
+
+  checkInputs = with python3Packages; [
+    pypdf2
+    pytest
+    pytest-helpers-namespace
+    pytest_xdist
+    pytestcov
+    pytestrunner
+    python-xmp-toolkit
+    setuptools
+  ] ++ runtimeDeps;
+
+  patches = [
+    (substituteAll {
+      src = ./liblept.patch;
+      liblept = "${stdenv.lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
+  ];
+
+  # The tests take potentially 20+ minutes, depending on machine
+  doCheck = false;
+
+  # These tests fail and it might be upstream problem... or packaging. :)
+  # development is happening on macos and the pinned test versions are
+  # significantly newer than nixpkgs has. Program still works...
+  # (to the extent I've used it) -- Kiwi
+  checkPhase = ''
+    export HOME=$TMPDIR
+    pytest -k 'not test_force_ocr_on_pdf_with_no_images \
+    and not test_tesseract_crash \
+    and not test_tesseract_crash_autorotate \
+    and not test_ghostscript_pdfa_failure \
+    and not test_gs_render_failure \
+    and not test_gs_raster_failure \
+    and not test_bad_utf8 \
+    and not test_old_unpaper'
+  '';
+
+  makeWrapperArgs = [ "--prefix PATH : ${stdenv.lib.makeBinPath [ ghostscript jbig2enc pngquant qpdf tesseract4 unpaper ]}" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/jbarlow83/OCRmyPDF";
+    description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.kiwi ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ocrmypdf/liblept.patch b/nixpkgs/pkgs/tools/text/ocrmypdf/liblept.patch
new file mode 100644
index 000000000000..ed413a8b37bd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ocrmypdf/liblept.patch
@@ -0,0 +1,13 @@
+diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py
+index 328b063..b993cc9 100644
+--- a/src/ocrmypdf/leptonica.py
++++ b/src/ocrmypdf/leptonica.py
+@@ -46,7 +46,7 @@ if os.name == 'nt':
+     os.environ['PATH'] = shim_paths_with_program_files()
+ else:
+     libname = 'lept'
+-_libpath = find_library(libname)
++_libpath = '@liblept@'
+ if not _libpath:
+     raise MissingDependencyError(
+         """
diff --git a/nixpkgs/pkgs/tools/text/odt2txt/default.nix b/nixpkgs/pkgs/tools/text/odt2txt/default.nix
new file mode 100644
index 000000000000..2a64533a459f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/odt2txt/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, zlib, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "odt2txt";
+  version = "0.5";
+
+  src = fetchurl {
+    url = "${meta.homepage}/archive/v${version}.tar.gz";
+    sha256 = "23a889109ca9087a719c638758f14cc3b867a5dcf30a6c90bf6a0985073556dd";
+  };
+
+  configurePhase="export makeFlags=\"DESTDIR=$out\"";
+
+  buildInputs = [ zlib libiconv ];
+
+  meta = {
+    description = "Simple .odt to .txt converter";
+    homepage = "https://github.com/dstosberg/odt2txt";
+    platforms = stdenv.lib.platforms.all;
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/opencc/default.nix b/nixpkgs/pkgs/tools/text/opencc/default.nix
new file mode 100644
index 000000000000..54027de9acde
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/opencc/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, cmake, python }:
+
+stdenv.mkDerivation rec {
+  pname = "opencc";
+  version = "1.0.6";
+
+  src = fetchFromGitHub {
+    owner = "BYVoid";
+    repo = "OpenCC";
+    rev = "ver.${version}";
+    sha256 = "1ygj2ygxsva72hs6cm0a6wdd2rp71k4nm0pd7cb20y2srdlzvdqk";
+  };
+
+  nativeBuildInputs = [ cmake python ];
+
+  # let intermediate tools find intermediate library
+  preBuild = stdenv.lib.optionalString stdenv.isLinux ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$(pwd)/src
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$(pwd)/src
+  '';
+
+  # Parallel building occasionaly fails with: Error copying file "/tmp/nix-build-opencc-1.0.5.drv-0/OpenCC-ver.1.0.5/build/src/libopencc.so.1.0.0" to "/tmp/nix-build-opencc-1.0.5.drv-0/OpenCC-ver.1.0.5/build/src/tools".
+  enableParallelBuilding = false;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BYVoid/OpenCC";
+    license = licenses.asl20;
+    description = "A project for conversion between Traditional and Simplified Chinese";
+    longDescription = ''
+      Open Chinese Convert (OpenCC) is an opensource project for conversion between
+      Traditional Chinese and Simplified Chinese, supporting character-level conversion,
+      phrase-level conversion, variant conversion and regional idioms among Mainland China,
+      Taiwan and Hong kong.
+    '';
+    maintainers = with maintainers; [ sifmelcara ];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/papertrail/Gemfile b/nixpkgs/pkgs/tools/text/papertrail/Gemfile
new file mode 100755
index 000000000000..199cd1422aaa
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/papertrail/Gemfile
@@ -0,0 +1,4 @@
+# frozen_string_literal: true
+source "https://rubygems.org"
+
+gem "papertrail"
diff --git a/nixpkgs/pkgs/tools/text/papertrail/Gemfile.lock b/nixpkgs/pkgs/tools/text/papertrail/Gemfile.lock
new file mode 100644
index 000000000000..37cd23eab6f5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/papertrail/Gemfile.lock
@@ -0,0 +1,17 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    ansi (1.5.0)
+    chronic (0.10.2)
+    papertrail (0.10.1)
+      ansi (~> 1.5)
+      chronic (~> 0.10)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  papertrail
+
+BUNDLED WITH
+   2.1.4
diff --git a/nixpkgs/pkgs/tools/text/papertrail/default.nix b/nixpkgs/pkgs/tools/text/papertrail/default.nix
new file mode 100644
index 000000000000..d635fab74d5a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/papertrail/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, bundlerEnv, ruby, bundlerUpdateScript }:
+
+let
+  papertrail-env = bundlerEnv {
+    name = "papertrail-env";
+    inherit ruby;
+    gemfile = ./Gemfile;
+    lockfile = ./Gemfile.lock;
+    gemset = ./gemset.nix;
+  };
+in stdenv.mkDerivation {
+  name = "papertrail-${(import ./gemset.nix).papertrail.version}";
+
+  phases = [ "installPhase" ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    ln -s ${papertrail-env}/bin/papertrail $out/bin/papertrail
+  '';
+
+  passthru.updateScript = bundlerUpdateScript "papertrail";
+
+  meta = with stdenv.lib; {
+    description = "Command-line client for Papertrail log management service";
+    homepage    = "https://github.com/papertrail/papertrail-cli/";
+    license     = licenses.mit;
+    maintainers = with maintainers; [ nicknovitski ];
+    platforms   = ruby.meta.platforms;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/papertrail/gemset.nix b/nixpkgs/pkgs/tools/text/papertrail/gemset.nix
new file mode 100644
index 000000000000..91bfe3198963
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/papertrail/gemset.nix
@@ -0,0 +1,26 @@
+{
+  ansi = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "14ims9zfal4gs2wpx2m5rd8zsrl2k794d359shkrsgg3fhr2a22l";
+      type = "gem";
+    };
+    version = "1.5.0";
+  };
+  chronic = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1hrdkn4g8x7dlzxwb1rfgr8kw3bp4ywg5l4y4i9c2g5cwv62yvvn";
+      type = "gem";
+    };
+    version = "0.10.2";
+  };
+  papertrail = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0vb7bh7qh5hr4v3w711bl0yrr3rlhz5c3h3qx3fq31dr5y4100v7";
+      type = "gem";
+    };
+    version = "0.10.1";
+  };
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/tools/text/par/default.nix b/nixpkgs/pkgs/tools/text/par/default.nix
new file mode 100644
index 000000000000..54b5e6566e87
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/par/default.nix
@@ -0,0 +1,39 @@
+{stdenv, fetchurl, fetchpatch}:
+
+stdenv.mkDerivation {
+  pname = "par";
+  version = "1.52";
+
+  src = fetchurl {
+    url = "http://www.nicemice.net/par/Par152.tar.gz";
+    sha256 = "33dcdae905f4b4267b4dc1f3efb032d79705ca8d2122e17efdecfd8162067082";
+  };
+
+  patches = [
+    # A patch by Jérôme Pouiller that adds support for multibyte
+    # charsets (like UTF-8), plus Debian packaging.
+    (fetchpatch {
+      url = "http://sysmic.org/dl/par/par-1.52-i18n.4.patch";
+      sha256 = "0alw44lf511jmr38jnh4j0mpp7vclgy0grkxzqf7q158vzdb6g23";
+    })
+  ];
+
+  buildPhase = ''make -f protoMakefile'';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp par $out/bin
+
+    mkdir -p $out/share/man/man1
+    cp  par.1 $out/share/man/man1
+  '';
+
+
+  meta = with stdenv.lib; {
+    homepage = "http://www.nicemice.net/par/";
+    description = "Paragraph reflow for email";
+    platforms = platforms.unix;
+    # See https://fedoraproject.org/wiki/Licensing/Par for license details
+    license = licenses.free;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/patchutils/0.3.3.nix b/nixpkgs/pkgs/tools/text/patchutils/0.3.3.nix
new file mode 100644
index 000000000000..f50354199c3f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/patchutils/0.3.3.nix
@@ -0,0 +1,7 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  version = "0.3.3";
+  sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i";
+  patches = [ ./drop-comments.patch ]; # we would get into a cycle when using fetchpatch on this one
+})
diff --git a/nixpkgs/pkgs/tools/text/patchutils/default.nix b/nixpkgs/pkgs/tools/text/patchutils/default.nix
new file mode 100644
index 000000000000..902773f40fa4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/patchutils/default.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... } @ args:
+
+callPackage ./generic.nix (args // {
+  version = "0.3.4";
+  sha256 = "0xp8mcfyi5nmb5a2zi5ibmyshxkb1zv1dgmnyn413m7ahgdx8mfg";
+})
diff --git a/nixpkgs/pkgs/tools/text/patchutils/drop-comments.patch b/nixpkgs/pkgs/tools/text/patchutils/drop-comments.patch
new file mode 100644
index 000000000000..e02693a5683d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/patchutils/drop-comments.patch
@@ -0,0 +1,84 @@
+From 58987954647f51dc42fb13b7759923c6170dd905 Mon Sep 17 00:00:00 2001
+From: Tim Waugh <twaugh@redhat.com>
+Date: Fri, 9 May 2014 16:23:27 +0100
+Subject: Make --clean drop comments after '@@' lines as well (trac #29).
+
+
+diff --git a/Makefile.am b/Makefile.am
+index 99ad2a3..f3c6dbc 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -198,6 +198,7 @@ TESTS = tests/newline1/run-test \
+ 	tests/convert1/run-test \
+ 	tests/convert2/run-test \
+ 	tests/clean1/run-test \
++	tests/clean2/run-test \
+ 	tests/stdin/run-test
+ 
+ # These ones don't work yet.
+diff --git a/src/filterdiff.c b/src/filterdiff.c
+index 383e72b..6ca2316 100644
+--- a/src/filterdiff.c
++++ b/src/filterdiff.c
+@@ -2,7 +2,7 @@
+  * filterdiff - extract (or exclude) a diff from a diff file
+  * lsdiff - show which files are modified by a patch
+  * grepdiff - show files modified by a patch containing a regexp
+- * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011 Tim Waugh <twaugh@redhat.com>
++ * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011, 2013, 2014 Tim Waugh <twaugh@redhat.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -408,7 +408,8 @@ do_unified (FILE *f, char *header[2], int match, char **line,
+ 							 " Hunk #%lu, %s",
+ 							 hunknum, bestname);
+ 
+-					fputs (trailing, output_to);
++					fputs (clean_comments ? "\n" : trailing,
++					       output_to);
+ 					break;
+ 				case Before:
+ 					// Note the initial line number
+diff --git a/tests/clean2/run-test b/tests/clean2/run-test
+new file mode 100755
+index 0000000..42320df
+--- /dev/null
++++ b/tests/clean2/run-test
+@@ -0,0 +1,34 @@
++#!/bin/sh
++
++# This is a filterdiff(1) testcase.
++# Test: Make sure --clean removes hunk-level comments.
++
++
++. ${top_srcdir-.}/tests/common.sh
++
++cat << EOF > diff
++non-diff line
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@ this is a hunk-level comment
+++a
++EOF
++
++${FILTERDIFF} --clean diff 2>errors >filtered || exit 1
++[ -s errors ] && exit 1
++
++cat << EOF | cmp - filtered || exit 1
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@
+++a
++EOF
++
++${FILTERDIFF} --clean -x file1 diff 2>errors >filtered || exit 1
++[ -s errors ] && exit 1
++cat << EOF | cmp - filtered || exit 1
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@
+++a
++EOF
+-- 
+cgit v0.10.1
+
diff --git a/nixpkgs/pkgs/tools/text/patchutils/generic.nix b/nixpkgs/pkgs/tools/text/patchutils/generic.nix
new file mode 100644
index 000000000000..52961e58c0ee
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/patchutils/generic.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, perl
+, version, sha256, patches ? []
+, ...
+}:
+stdenv.mkDerivation rec {
+  pname = "patchutils";
+  inherit version patches;
+
+  src = fetchurl {
+    url = "http://cyberelk.net/tim/data/patchutils/stable/${pname}-${version}.tar.xz";
+    inherit sha256;
+  };
+
+  buildInputs = [ perl ];
+  hardeningDisable = [ "format" ];
+
+  doCheck = false; # fails
+
+  meta = with stdenv.lib; {
+    description = "Tools to manipulate patch files";
+    homepage = "http://cyberelk.net/tim/software/patchutils";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
+      "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
+      "recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/peco/default.nix b/nixpkgs/pkgs/tools/text/peco/default.nix
new file mode 100644
index 000000000000..c5655cb2a585
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/peco/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "peco";
+  version = "0.5.3";
+
+  goPackagePath = "github.com/peco/peco";
+  subPackages = [ "cmd/peco" ];
+
+  src = fetchFromGitHub {
+    owner = "peco";
+    repo = "peco";
+    rev = "v${version}";
+    sha256 = "1m3s1jrrhqccgg3frfnq6iprwwi97j13wksckpcyrg51z6y5q041";
+  };
+
+  goDeps = ./deps.nix;
+
+  meta = with stdenv.lib; {
+    description = "Simplistic interactive filtering tool";
+    homepage = "https://github.com/peco/peco";
+    license = licenses.mit;
+    # peco should work on Windows or other POSIX platforms, but the go package
+    # declares only linux and darwin.
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/peco/deps.nix b/nixpkgs/pkgs/tools/text/peco/deps.nix
new file mode 100644
index 000000000000..29bae2de5b51
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/peco/deps.nix
@@ -0,0 +1,57 @@
+# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
+[
+  {
+    goPackagePath = "github.com/google/btree";
+    fetch = {
+      type = "git";
+      url = "https://github.com/google/btree";
+      rev = "0c3044bc8bada22db67b93f5760fe3f05d6a5c25";
+      sha256 = "05rdnf2c9r0yicg17zsq58i0sm32p0lk8zdnb7nhr0v5hqldvps4";
+    };
+  }
+  {
+    goPackagePath = "github.com/jessevdk/go-flags";
+    fetch = {
+      type = "git";
+      url = "https://github.com/jessevdk/go-flags";
+      rev = "8bc97d602c3bfeb5fc6fc9b5a9c898f245495637";
+      sha256 = "1h3il3ycgd54flbyqys4hm4gzx1lyn5ja1k79f2y7zbs6y0mf1lz";
+    };
+  }
+  {
+    goPackagePath = "github.com/lestrrat/go-pdebug";
+    fetch = {
+      type = "git";
+      url = "https://github.com/lestrrat/go-pdebug";
+      rev = "2e6eaaa5717f81bda41d27070d3c966f40a1e75f";
+      sha256 = "05dx1f1yln47nazyi50zix82xbnyva3hily4gh5gaz021h01npax";
+    };
+  }
+  {
+    goPackagePath = "github.com/mattn/go-runewidth";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mattn/go-runewidth";
+      rev = "737072b4e32b7a5018b4a7125da8d12de90e8045";
+      sha256 = "09ni8bmj6p2b774bdh6mfcxl03bh5sqk860z03xpb6hv6yfxqkjm";
+    };
+  }
+  {
+    goPackagePath = "github.com/nsf/termbox-go";
+    fetch = {
+      type = "git";
+      url = "https://github.com/nsf/termbox-go";
+      rev = "e2050e41c8847748ec5288741c0b19a8cb26d084";
+      sha256 = "181b1df2b6fcn5wizq2qqxl1kwqbih5k15n08rx3bcz36q34n23s";
+    };
+  }
+  {
+    goPackagePath = "github.com/pkg/errors";
+    fetch = {
+      type = "git";
+      url = "https://github.com/pkg/errors";
+      rev = "248dadf4e9068a0b3e79f02ed0a610d935de5302";
+      sha256 = "03l80r0i9bxl0vz363w62k4a8apzglgbrz6viwym3044sxkl1qks";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/text/platinum-searcher/default.nix b/nixpkgs/pkgs/tools/text/platinum-searcher/default.nix
new file mode 100644
index 000000000000..53aa9ac7b76d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/platinum-searcher/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "the_platinum_searcher";
+  version = "2.1.5";
+  rev = "v${version}";
+
+  goPackagePath = "github.com/monochromegane/the_platinum_searcher";
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner = "monochromegane";
+    repo = "the_platinum_searcher";
+    sha256 = "1y7kl3954dimx9hp2bf1vjg1h52hj1v6cm4f5nhrqzwrawp0b6q0";
+  };
+
+  goDeps = ./deps.nix;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/monochromegane/the_platinum_searcher";
+    description = "A code search tool similar to ack and the_silver_searcher(ag).";
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/platinum-searcher/deps.nix b/nixpkgs/pkgs/tools/text/platinum-searcher/deps.nix
new file mode 100644
index 000000000000..04fb9bd4be34
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/platinum-searcher/deps.nix
@@ -0,0 +1,83 @@
+[
+  {
+    goPackagePath = "gopkg.in/yaml.v2";
+    fetch = {
+      type = "git";
+      url = "https://gopkg.in/yaml.v2";
+      rev = "a5b47d31c556af34a302ce5d659e6fea44d90de0";
+      sha256 = "0v6l48fshdjrqzyq1kwn22gy7vy434xdr1i0lm3prsf6jbln9fam";
+    };
+  }
+  {
+    goPackagePath = "github.com/jessevdk/go-flags";
+    fetch = {
+      type = "git";
+      url = "https://github.com/jessevdk/go-flags";
+      rev = "4e64e4a4e2552194cf594243e23aa9baf3b4297e";
+      sha256 = "02x7f1wm8119s27h4dc3a4aw6shydnpnnkvzwg5xm0snn5kb4zxm";
+    };
+  }
+  {
+    goPackagePath = "github.com/BurntSushi/toml";
+    fetch = {
+      type = "git";
+      url = "https://github.com/BurntSushi/toml";
+      rev = "99064174e013895bbd9b025c31100bd1d9b590ca";
+      sha256 = "058qrar8rvw3wb0ci1mf1axnqq2729cvv9zmdr4ms2nn9s97yiz9";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/text";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/text";
+      rev = "a49bea13b776691cb1b49873e5d8df96ec74831a";
+      sha256 = "1pcmgf88wml6ca8v63nh3nxsfvpzjv3c4qj2w2wkizbil826g7as";
+    };
+  }
+  {
+    goPackagePath = "github.com/monochromegane/conflag";
+    fetch = {
+      type = "git";
+      url = "https://github.com/monochromegane/conflag";
+      rev = "6d68c9aa4183844ddc1655481798fe4d90d483e9";
+      sha256 = "0csfr5c8d3kbna9sqhzfp2z06wq6mc6ijja1zj2i82kzsq8534wa";
+    };
+  }
+  {
+    goPackagePath = "github.com/monochromegane/go-home";
+    fetch = {
+      type = "git";
+      url = "https://github.com/monochromegane/go-home";
+      rev = "25d9dda593924a11ea52e4ffbc8abdb0dbe96401";
+      sha256 = "172chakrj22xfm0bcda4qj5zqf7lwr53pzwc3xj6wz8vd2bcxkww";
+    };
+  }
+  {
+    goPackagePath = "github.com/monochromegane/terminal";
+    fetch = {
+      type = "git";
+      url = "https://github.com/monochromegane/terminal";
+      rev = "2da212063ce19aed90ee5bbb00ad1ad7393d7f48";
+      sha256 = "1rddaq9pk5q57ildms35iihghqk505gb349pb0f6k3svchay38nh";
+    };
+  }
+  {
+    goPackagePath = "github.com/monochromegane/go-gitignore";
+    fetch = {
+      type = "git";
+      url = "https://github.com/monochromegane/go-gitignore";
+      rev = "38717d0a108ca0e5af632cd6845ca77d45b50729";
+      sha256 = "0r1inabpgg6sn6i47b02hcmd2p4dc1ab1mcy20mn1b2k3mpdj4b7";
+    };
+  }
+  {
+    goPackagePath = "github.com/shiena/ansicolor";
+    fetch = {
+      type = "git";
+      url = "https://github.com/shiena/ansicolor";
+      rev = "a422bbe96644373c5753384a59d678f7d261ff10";
+      sha256 = "1dcn8a9z6a5dxa2m3fkppnajcls8lanbl38qggkf646yi5qsk1hc";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/text/podiff/default.nix b/nixpkgs/pkgs/tools/text/podiff/default.nix
new file mode 100644
index 000000000000..bee2c7a1a8f8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/podiff/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  pname = "podiff";
+  version = "1.1";
+
+  src = fetchurl {
+    url = "ftp://download.gnu.org.ua/pub/release/podiff/podiff-1.1.tar.gz";
+    sha256 = "1zz6bcmka5zvk2rq775qv122lqh54aijkxlghvx7z0r6kh880x59";
+  };
+
+  patchPhase = ''
+    sed "s#PREFIX=/usr#PREFIX=$out#g" -i Makefile
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Finds differences in translations between two PO files, or revisions";
+    homepage = "http://puszcza.gnu.org.ua/software/podiff";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/poedit/default.nix b/nixpkgs/pkgs/tools/text/poedit/default.nix
new file mode 100644
index 000000000000..767569e42c20
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/poedit/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, gettext, pkgconfig, wxGTK30,
+  boost, icu, lucenepp, asciidoc, libxslt, xmlto, gtk2, gtkspell2, pugixml,
+  nlohmann_json, hicolor-icon-theme, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  pname = "poedit";
+  version = "2.3";
+
+  src = fetchurl {
+    url = "https://github.com/vslavik/poedit/archive/v${version}-oss.tar.gz";
+    sha256 = "0smvdpvb4hdhqc327pcj29bzjqbzgad6mr7r5pg81461fi2r2myw";
+  };
+
+  nativeBuildInputs = [ autoconf automake asciidoc wrapGAppsHook 
+    libxslt xmlto boost libtool pkgconfig ];
+
+  buildInputs = [ lucenepp nlohmann_json wxGTK30 icu pugixml gtk2 gtkspell2 hicolor-icon-theme ];
+
+  propagatedBuildInputs = [ gettext ];
+  
+  preConfigure = "
+    patchShebangs bootstrap
+    ./bootstrap
+  ";
+
+  configureFlags = [
+    "--without-cld2"
+    "--without-cpprest"
+    "--with-boost-libdir=${boost.out}/lib"
+    "CPPFLAGS=-I${nlohmann_json}/include/nlohmann/"
+  ];
+ 
+  preFixup = ''
+    gappsWrapperArgs+=(--prefix PATH : "${stdenv.lib.makeBinPath [ gettext ]}")
+  '';
+ 
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Cross-platform gettext catalogs (.po files) editor";
+    homepage = "https://www.poedit.net/";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ domenkozar genesis ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/popfile/default.nix b/nixpkgs/pkgs/tools/text/popfile/default.nix
new file mode 100644
index 000000000000..b7134ba73564
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/popfile/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchzip, makeWrapper, perlPackages,
+... }:
+
+stdenv.mkDerivation rec {
+  appname = "popfile";
+  version = "1.1.3";
+  name = "${appname}-${version}";
+
+  src = fetchzip {
+    url = "http://getpopfile.org/downloads/${appname}-${version}.zip";
+    sha256 = "0gcib9j7zxk8r2vb5dbdz836djnyfza36vi8215nxcdfx1xc7l63";
+    stripRoot = false;
+  };
+
+  buildInputs = [ makeWrapper ] ++ (with perlPackages; [
+    ## These are all taken from the popfile documentation as applicable to Linux
+    ## http://getpopfile.org/docs/howtos:allplatformsrequireperl
+    perl
+    DBI
+    DBDSQLite
+    HTMLTagset
+    TimeDate # == DateParse
+    HTMLTemplate
+    # IO::Socket::Socks is not in nixpkgs
+    # IOSocketSocks
+    IOSocketSSL
+    NetSSLeay
+    SOAPLite
+  ]);
+
+  installPhase = ''
+    mkdir -p $out/bin
+    # I user `cd` rather than `cp $out/* ...` b/c the * breaks syntax
+    # highlighting in emacs for me.
+    cd $src
+    cp -r * $out/bin
+    cd $out/bin
+    chmod +x *.pl
+
+    find $out -name '*.pl' -executable | while read path; do
+      wrapProgram "$path" \
+        --prefix PERL5LIB : $PERL5LIB:$out/bin \
+        --set POPFILE_ROOT $out/bin \
+        --run 'export POPFILE_USER=''${POPFILE_USER:-$HOME/.popfile}' \
+        --run 'test -d "$POPFILE_USER" || mkdir -m 0700 -p "$POPFILE_USER"'
+    done
+  '';
+
+  meta = {
+    description = "An email classification system that automatically sorts messages and fights spam";
+    homepage = "http://getpopfile.org";
+    license = stdenv.lib.licenses.gpl2;
+
+    # Should work on macOS, but havent tested it.
+    # Windows support is more complicated.
+    # http://getpopfile.org/docs/faq:systemrequirements
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/proselint/default.nix b/nixpkgs/pkgs/tools/text/proselint/default.nix
new file mode 100644
index 000000000000..36a68f9406d3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/proselint/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, buildPythonApplication, click, future, six }:
+
+buildPythonApplication rec {
+  pname = "proselint";
+  version = "0.10.2";
+
+  doCheck = false; # fails to pass because it tries to run in home directory
+
+  src = fetchurl {
+    url = "mirror://pypi/p/proselint/${pname}-${version}.tar.gz";
+    sha256 = "017risn0j1bjy9ygzfgphjnyjl4gk7wbrr4qv1vvrlan60wyp1rs";
+  };
+
+  propagatedBuildInputs = [ click future six ];
+
+  meta = with stdenv.lib; {
+    description = "A linter for prose";
+    homepage = "http://proselint.com";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ alibabzo ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/qgrep/default.nix b/nixpkgs/pkgs/tools/text/qgrep/default.nix
new file mode 100644
index 000000000000..30873e89d1bf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/qgrep/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchFromGitHub, CoreServices, CoreFoundation, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  version = "1.1";
+  pname = "qgrep";
+
+  src = fetchFromGitHub {
+    owner = "zeux";
+    repo = "qgrep";
+    rev = "v${version}";
+    sha256 = "046ccw34vz2k5jn6gyxign5gs2qi7i50jy9b74wqv7sjf5zayrh0";
+    fetchSubmodules = true;
+  };
+
+  patches = stdenv.lib.optionals stdenv.isDarwin [
+    (fetchpatch {
+      url = "https://github.com/zeux/qgrep/commit/21c4d1a5ab0f0bdaa0b5ca993c1315c041418cc6.patch";
+      sha256 = "0wpxzrd9pmhgbgby17vb8279xwvkxfdd99gvv7r74indgdxqg7v8";
+    })
+  ];
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreFoundation ];
+
+  postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
+    substituteInPlace Makefile \
+      --replace "-msse2" "" --replace "-DUSE_SSE2" ""
+  '';
+
+  installPhase = '' 
+    install -Dm755 qgrep $out/bin/qgrep
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Fast regular expression grep for source code with incremental index updates";
+    homepage = "https://github.com/zeux/qgrep";
+    license = licenses.mit;
+    maintainers = [ maintainers.yrashk ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/qprint/default.nix b/nixpkgs/pkgs/tools/text/qprint/default.nix
new file mode 100644
index 000000000000..d616d15ad75b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/qprint/default.nix
@@ -0,0 +1,28 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "qprint-1.1";
+
+  src = fetchurl {
+    url = "https://www.fourmilab.ch/webtools/qprint/${name}.tar.gz";
+    sha256 = "1701cnb1nl84rmcpxzq11w4cyj4385jh3gx4aqxznwf8a4fwmagz";
+  };
+
+  doCheck = true;
+
+  checkTarget = "wringer";
+
+  preInstall = ''
+    mkdir -p $out/bin
+    mkdir -p $out/share/man/man1
+  '';
+
+  meta = {
+    homepage = "http://www.fourmilab.ch/webtools/qprint/";
+    license = stdenv.lib.licenses.publicDomain;
+    description = "Encode and decode Quoted-Printable files";
+    maintainers = [ stdenv.lib.maintainers.tv ];
+    platforms = stdenv.lib.platforms.all;
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/text/qshowdiff/default.nix b/nixpkgs/pkgs/tools/text/qshowdiff/default.nix
new file mode 100644
index 000000000000..bb2eeee8a9e2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/qshowdiff/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, qt4, perl, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "qshowdiff";
+  version = "1.2";
+
+  src = fetchurl {
+    url = "https://github.com/danfis/qshowdiff/archive/v${version}.tar.gz";
+    sha256 = "027959xbzvi5c2w9y1x122sr5i26k9mvp43banz2wln6gd860n1a";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ qt4 perl ];
+
+  configurePhase = ''
+    mkdir -p $out/{bin,man/man1}
+    makeFlags="PREFIX=$out CC=$CXX"
+  '';
+
+  meta = {
+    homepage = "http://qshowdiff.danfis.cz/";
+    description = "Colourful diff viewer";
+    license = stdenv.lib.licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/reckon/Gemfile b/nixpkgs/pkgs/tools/text/reckon/Gemfile
new file mode 100644
index 000000000000..f708ddd93664
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/reckon/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'reckon'
diff --git a/nixpkgs/pkgs/tools/text/reckon/Gemfile.lock b/nixpkgs/pkgs/tools/text/reckon/Gemfile.lock
new file mode 100644
index 000000000000..94f0f8f506c2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/reckon/Gemfile.lock
@@ -0,0 +1,21 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    chronic (0.10.2)
+    fastercsv (1.5.5)
+    highline (1.7.8)
+    reckon (0.4.4)
+      chronic (>= 0.3.0)
+      fastercsv (>= 1.5.1)
+      highline (>= 1.5.2)
+      terminal-table (>= 1.4.2)
+    terminal-table (1.6.0)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  reckon
+
+BUNDLED WITH
+   2.1.4
diff --git a/nixpkgs/pkgs/tools/text/reckon/default.nix b/nixpkgs/pkgs/tools/text/reckon/default.nix
new file mode 100644
index 000000000000..261149229b64
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/reckon/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, bundlerEnv, bundlerUpdateScript, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "reckon";
+  version = (import ./gemset.nix).reckon.version;
+
+  phases = [ "installPhase" ];
+
+  buildInputs = [ makeWrapper ];
+
+  installPhase = let
+    env = bundlerEnv {
+      name = "${pname}-${version}-gems";
+
+      gemdir = ./.;
+    };
+  in ''
+    mkdir -p $out/bin
+    makeWrapper ${env}/bin/reckon $out/bin/reckon
+  '';
+
+  passthru.updateScript = bundlerUpdateScript "reckon";
+
+  meta = with lib; {
+    description = "Flexibly import bank account CSV files into Ledger for command line accounting";
+    license = licenses.mit;
+    maintainers = with maintainers; [ nicknovitski ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/reckon/gemset.nix b/nixpkgs/pkgs/tools/text/reckon/gemset.nix
new file mode 100644
index 000000000000..e1e4a43188df
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/reckon/gemset.nix
@@ -0,0 +1,42 @@
+{
+  chronic = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1hrdkn4g8x7dlzxwb1rfgr8kw3bp4ywg5l4y4i9c2g5cwv62yvvn";
+      type = "gem";
+    };
+    version = "0.10.2";
+  };
+  fastercsv = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1df3vfgw5wg0s405z0pj0rfcvnl9q6wak7ka8gn0xqg4cag1k66h";
+      type = "gem";
+    };
+    version = "1.5.5";
+  };
+  highline = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1nf5lgdn6ni2lpfdn4gk3gi47fmnca2bdirabbjbz1fk9w4p8lkr";
+      type = "gem";
+    };
+    version = "1.7.8";
+  };
+  reckon = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1p6w8w7vpl8fq4yfggrxbv6ph76psg7l5b4q29a8zvfbzzx6a0xw";
+      type = "gem";
+    };
+    version = "0.4.4";
+  };
+  terminal-table = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0hbmzfr17ji5ws5x5z3kypmb5irwwss7q7kkad0gs005ibqrxv0a";
+      type = "gem";
+    };
+    version = "1.6.0";
+  };
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/tools/text/recode/default.nix b/nixpkgs/pkgs/tools/text/recode/default.nix
new file mode 100644
index 000000000000..b562c92679b2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/recode/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, python3, perl, intltool, flex, texinfo, libiconv, libintl }:
+
+stdenv.mkDerivation rec {
+  pname = "recode";
+  version = "3.7.6";
+
+  # Use official tarball, avoid need to bootstrap/generate build system
+  src = fetchurl {
+    url = "https://github.com/rrthomas/${pname}/releases/download/v${version}/${pname}-${version}.tar.gz";
+    sha256 = "0m59sd1ca0zw1aydpc3m8sw03nc885knmccqryg7byzmqs585ia6";
+  };
+
+  nativeBuildInputs = [ python3 python3.pkgs.cython perl intltool flex texinfo libiconv ];
+  buildInputs = [ libintl ];
+
+  doCheck = true;
+
+  meta = {
+    homepage = "https://github.com/rrthomas/recode";
+    description = "Converts files between various character sets and usages";
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/replace/default.nix b/nixpkgs/pkgs/tools/text/replace/default.nix
new file mode 100644
index 000000000000..009c3dcd8c58
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/replace/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "replace-2.24";
+
+  src = fetchurl {
+    url = "ftp://hpux.connect.org.uk/hpux/Users/replace-2.24/replace-2.24-src-11.11.tar.gz";
+    sha256 = "1c2nkxx83vmlh1v3ib6r2xqh121gdb1rharwsimcb2h0xwc558dm";
+  };
+
+  outputs = [ "out" "man" ];
+
+  makeFlags = [ "TREE=\$(out)" "MANTREE=\$(TREE)/share/man" ];
+
+  preBuild = ''
+    sed -e "s@/bin/mv@$(type -P mv)@" -i replace.h
+  '';
+
+  preInstall = "mkdir -p \$out/share/man";
+  postInstall = "mv \$out/bin/replace \$out/bin/replace-literal";
+
+  patches = [./malloc.patch];
+
+  meta = {
+    homepage = "https://replace.richardlloyd.org.uk/";
+    description = "A tool to replace verbatim strings";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/replace/malloc.patch b/nixpkgs/pkgs/tools/text/replace/malloc.patch
new file mode 100644
index 000000000000..1ee95c4bae18
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/replace/malloc.patch
@@ -0,0 +1,13 @@
+diff -rc replace-2.24-orig/replace.h replace-2.24/replace.h
+*** replace-2.24-orig/replace.h	2004-10-07 15:15:06.000000000 +0200
+--- replace-2.24/replace.h	2008-02-21 14:57:47.000000000 +0100
+***************
+*** 11,17 ****
+  #include <ctype.h>
+  #include <unistd.h>
+  #include <string.h>
+- #include <malloc.h>
+  #include <sys/stat.h>
+  #include <ftw.h>
+  #include <utime.h>
+--- 11,16 ----
diff --git a/nixpkgs/pkgs/tools/text/ripgrep-all/default.nix b/nixpkgs/pkgs/tools/text/ripgrep-all/default.nix
new file mode 100644
index 000000000000..dcce9bf32911
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ripgrep-all/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, lib, fetchFromGitHub, rustPlatform, makeWrapper, ffmpeg
+, pandoc, poppler_utils, ripgrep, Security, imagemagick, tesseract
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ripgrep-all";
+  version = "0.9.5";
+
+  src = fetchFromGitHub {
+    owner = "phiresky";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1nl03i36ilhxn5xbcry6pcr7vbl5667m43flpxaa0lf1wijzn5c2";
+  };
+
+  cargoSha256 = "0ndyd8qrvljkk6yvpsp0w17iizxb529sh5q2bj790m32x0gz2w8l";
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = lib.optional stdenv.isDarwin Security;
+
+  postInstall = ''
+    wrapProgram $out/bin/rga \
+      --prefix PATH ":" "${lib.makeBinPath [ ffmpeg pandoc poppler_utils ripgrep imagemagick tesseract ]}"
+  '';
+
+  # Use upstream's example data to run a couple of queries to ensure the dependencies
+  # for all of the adapters are available.
+  installCheckPhase = ''
+    set -e
+    export PATH="$PATH:$out/bin"
+
+    test1=$(rga --rga-no-cache "hello" exampledir/ | wc -l)
+    test2=$(rga --rga-no-cache --rga-adapters=tesseract "crate" exampledir/screenshot.png | wc -l)
+
+    if [ $test1 != 26 ]
+    then
+      echo "ERROR: test1 failed! Could not find the word 'hello' 26 times in the sample data."
+      exit 1
+    fi
+
+    if [ $test2 != 1 ]
+    then
+      echo "ERROR: test2 failed! Could not find the word 'crate' in the screenshot."
+      exit 1
+    fi
+  '';
+
+  doInstallCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more";
+    longDescription = ''
+      Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.
+
+      rga is a line-oriented search tool that allows you to look for a regex in
+      a multitude of file types. rga wraps the awesome ripgrep and enables it
+      to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4), etc.
+    '';
+    homepage = "https://github.com/phiresky/ripgrep-all";
+    license = with licenses; [ agpl3Plus ];
+    maintainers = with maintainers; [ zaninime ma27 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ripgrep/default.nix b/nixpkgs/pkgs/tools/text/ripgrep/default.nix
new file mode 100644
index 000000000000..c794b4ba33c7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ripgrep/default.nix
@@ -0,0 +1,46 @@
+{ stdenv
+, fetchFromGitHub
+, rustPlatform
+, asciidoc
+, docbook_xsl
+, libxslt
+, installShellFiles
+, Security
+, withPCRE2 ? true
+, pcre2 ? null
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ripgrep";
+  version = "12.0.1";
+
+  src = fetchFromGitHub {
+    owner = "BurntSushi";
+    repo = pname;
+    rev = version;
+    sha256 = "1c0v51s05kbg9825n6mvpizhkkgz38wl7hp8f3vzbjfg4i8l8wb0";
+  };
+
+  cargoSha256 = "0i8x2xgri8f8mzrlkc8l2yzcgczl35nw4bmwg09d343mjkmk6d8y";
+
+  cargoBuildFlags = stdenv.lib.optional withPCRE2 "--features pcre2";
+
+  nativeBuildInputs = [ asciidoc docbook_xsl libxslt installShellFiles ];
+  buildInputs = (stdenv.lib.optional withPCRE2 pcre2)
+  ++ (stdenv.lib.optional stdenv.isDarwin Security);
+
+  preFixup = ''
+    (cd target/release/build/ripgrep-*/out
+    installManPage rg.1
+    installShellCompletion rg.{bash,fish})
+    installShellCompletion --zsh "$src/complete/_rg"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A utility that combines the usability of The Silver Searcher with the raw speed of grep";
+    homepage = "https://github.com/BurntSushi/ripgrep";
+    license = with licenses; [ unlicense /* or */ mit ];
+    maintainers = with maintainers; [ tailhook globin ma27 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/rosie/default.nix b/nixpkgs/pkgs/tools/text/rosie/default.nix
new file mode 100644
index 000000000000..4f70f972b683
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/rosie/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, lib
+, fetchgit
+, libbsd
+, readline
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rosie";
+  version = "unstable-2020-01-11";
+  src = fetchgit {
+    url = "https://gitlab.com/rosie-pattern-language/rosie";
+    rev = "670e9027563609ba2ea31e14e2621a1302742795";
+    sha256 = "0jc512dbn62a1fniknhbp6q0xa1p7xi3hn5v60is8sy9jgi3afxv";
+    fetchSubmodules = true;
+  };
+
+  postUnpack = ''
+    # The Makefile calls git to update submodules, unless this file exists
+    touch ${src.name}/submodules/~~present~~
+  '';
+
+  preConfigure = ''
+    patchShebangs src/build_info.sh
+    # Part of the same Makefile target which calls git to update submodules
+    ln -s src submodules/lua/include
+  '';
+
+  postInstall = ''
+    mkdir -p $out/share/emacs/site-lisp $out/share/vim-plugins $out/share/nvim
+    mv $out/lib/rosie/extra/extra/emacs/* $out/share/emacs/site-lisp/
+    mv $out/lib/rosie/extra/extra/vim $out/share/vim-plugins/rosie
+    ln -s $out/share/vim-plugins/rosie $out/share/nvim/site
+  '';
+
+  makeFlags = [ "DESTDIR=${placeholder "out"}" ];
+
+  buildInputs = [ libbsd readline ];
+
+  meta = with lib; {
+    homepage = "https://rosie-lang.org";
+    description = "Tools for searching using parsing expression grammars";
+    license = licenses.mit;
+    maintainers = with maintainers; [ kovirobi ];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/rpl/default.nix b/nixpkgs/pkgs/tools/text/rpl/default.nix
new file mode 100644
index 000000000000..7ac3790f8a98
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/rpl/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, pythonPackages }:
+
+pythonPackages.buildPythonApplication rec {
+  pname = "rpl";
+  version = "1.5.7";
+
+  # Tests not included in pip package.
+  doCheck = false;
+
+  src = fetchFromGitHub {
+    owner  = "kcoyner";
+    repo   = "rpl";
+    rev    = "v${version}";
+    sha256 = "1xhpgcmq91ivy9ijfyz5ilg51m7fz8ar2077r7gq246j8gbf8ggr";
+  };
+
+  meta = with stdenv.lib; {
+    description = "Replace strings in files";
+    homepage    = "https://github.com/kcoyner/rpl";
+    license     = licenses.gpl2;
+    maintainers = with maintainers; [ teto ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/rs/default.nix b/nixpkgs/pkgs/tools/text/rs/default.nix
new file mode 100644
index 000000000000..bd141f491d41
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/rs/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchurl, libbsd }:
+
+stdenv.mkDerivation rec {
+  pname = "rs";
+  version = "20200313";
+
+  src = fetchurl {
+    url = "https://www.mirbsd.org/MirOS/dist/mir/rs/${pname}-${version}.tar.gz";
+    sha256 = "0gxwlfk7bzivpp2260w2r6gkyl7vdi05cggn1fijfnp8kzf1b4li";
+  };
+
+  buildInputs = [ libbsd ];
+
+  buildPhase = ''
+    ${stdenv.cc}/bin/cc utf8.c rs.c -o rs -lbsd
+  '';
+
+  installPhase = ''
+    install -Dm 755 rs -t $out/bin
+    install -Dm 644 rs.1 -t $out/share/man/man1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Reshape a data array from standard input";
+    longDescription = ''
+      rs reads the standard input, interpreting each line as a row of blank-
+      separated entries in an array, transforms the array according to the op-
+      tions, and writes it on the standard output. With no arguments (argc < 2)
+      it transforms stream input into a columnar format convenient for terminal
+      viewing, i.e. if the length (in bytes!) of the first line is smaller than
+      the display width, -et is implied, -t otherwise.
+
+      The shape of the input array is deduced from the number of lines and the
+      number of columns on the first line. If that shape is inconvenient, a more
+      useful one might be obtained by skipping some of the input with the -k
+      option. Other options control interpretation of the input columns.
+
+      The shape of the output array is influenced by the rows and cols specifi-
+      cations, which should be positive integers. If only one of them is a po-
+      sitive integer, rs computes a value for the other which will accommodate
+      all of the data. When necessary, missing data are supplied in a manner
+      specified by the options and surplus data are deleted. There are options
+      to control presentation of the output columns, including transposition of
+      the rows and columns.
+    '';
+
+    homepage = "https://www.mirbsd.org/htman/i386/man1/rs.htm";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/rst2html5/default.nix b/nixpkgs/pkgs/tools/text/rst2html5/default.nix
new file mode 100644
index 000000000000..d20ce99dd74e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/rst2html5/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pythonPackages }:
+
+pythonPackages.buildPythonPackage rec {
+  pname = "rst2html5";
+  version = "1.9.4";
+
+  src = fetchurl {
+    url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "d044589d30eeaf7336986078b7bd175510fd649a212b01a457d7806b279e6c73";
+  };
+
+  propagatedBuildInputs = with pythonPackages;
+  [ docutils genshi pygments beautifulsoup4 ];
+
+  meta = with stdenv.lib;{
+    homepage = "https://bitbucket.org/andre_felipe_dias/rst2html5";
+    description = "Converts ReSTructuredText to (X)HTML5";
+    license = licenses.mit;
+    maintainers = with maintainers; [ AndersonTorres ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile b/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile
new file mode 100644
index 000000000000..4bb5d8c175d7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'ruby-zoom'
diff --git a/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile.lock b/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile.lock
new file mode 100644
index 000000000000..820a972d106d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ruby-zoom/Gemfile.lock
@@ -0,0 +1,24 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    djinni (2.2.4)
+      fagin (~> 1.2, >= 1.2.1)
+    fagin (1.2.1)
+    hilighter (1.2.3)
+    json_config (1.1.0)
+    ruby-zoom (5.3.0)
+      djinni (~> 2.2, >= 2.2.4)
+      fagin (~> 1.2, >= 1.2.1)
+      hilighter (~> 1.2, >= 1.2.3)
+      json_config (~> 1.0, >= 1.0.0)
+      scoobydoo (~> 1.0, >= 1.0.0)
+    scoobydoo (1.0.0)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  ruby-zoom
+
+BUNDLED WITH
+   1.17.2
diff --git a/nixpkgs/pkgs/tools/text/ruby-zoom/default.nix b/nixpkgs/pkgs/tools/text/ruby-zoom/default.nix
new file mode 100644
index 000000000000..965d23d0c44b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ruby-zoom/default.nix
@@ -0,0 +1,18 @@
+{ lib, bundlerEnv, ruby, bundlerUpdateScript }:
+
+bundlerEnv {
+  pname = "ruby-zoom";
+
+  inherit ruby;
+  gemdir = ./.;
+
+  passthru.updateScript = bundlerUpdateScript "ruby-zoom";
+
+  meta = with lib; {
+    description = "Quickly open CLI search results in your favorite editor!";
+    homepage    = "https://gitlab.com/mjwhitta/zoom";
+    license     = with licenses; gpl3;
+    maintainers = with maintainers; [ vmandela nicknovitski ];
+    platforms   = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/ruby-zoom/gemset.nix b/nixpkgs/pkgs/tools/text/ruby-zoom/gemset.nix
new file mode 100644
index 000000000000..f4c637aadf88
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ruby-zoom/gemset.nix
@@ -0,0 +1,64 @@
+{
+  djinni = {
+    dependencies = ["fagin"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "18zk80jk70xq1bnsvzcgxb13x9fqdb5g4m02b2f6mvqm4cyw26pl";
+      type = "gem";
+    };
+    version = "2.2.4";
+  };
+  fagin = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0psyydh4hf2s1kz0r50aiyjf5v2pqhkbmy0gicxzaj5n17q2ga24";
+      type = "gem";
+    };
+    version = "1.2.1";
+  };
+  hilighter = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "03zm49g96dfpan5fhblcjxrzv7ldwan57sn0jcllkcmrqfd0zlyz";
+      type = "gem";
+    };
+    version = "1.2.3";
+  };
+  json_config = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0slb618n1ipn47j6dsxbfv2j9pl06dxn2i651llix09d529m7zwa";
+      type = "gem";
+    };
+    version = "1.1.0";
+  };
+  ruby-zoom = {
+    dependencies = ["djinni" "fagin" "hilighter" "json_config" "scoobydoo"];
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0iqxc0rzypsxy4wbxnvgvk98dbcsrcczq3xi9xd4wz4ggwq564l3";
+      type = "gem";
+    };
+    version = "5.3.0";
+  };
+  scoobydoo = {
+    groups = ["default"];
+    platforms = [];
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "162p75nc9x078kqcpdsrsd7kngs6jc5n4injz3kzpwf0jgbbm8n7";
+      type = "gem";
+    };
+    version = "1.0.0";
+  };
+}
\ No newline at end of file
diff --git a/nixpkgs/pkgs/tools/text/ruplacer/default.nix b/nixpkgs/pkgs/tools/text/ruplacer/default.nix
new file mode 100644
index 000000000000..535a00b7b4d0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ruplacer/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, rustPlatform, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ruplacer";
+  version = "0.4.1";
+
+  src = fetchFromGitHub {
+    owner = "TankerHQ";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0yj753d9wsnp4s5a71ph241jym5rfz3161a1v3qxfc4w23v86j1q";
+  };
+
+  cargoSha256 = "0wrv4k63pc1v0apmxmmci9qaykcv9ig3nfxy6id5caqrckp73cr4";
+
+  buildInputs = (stdenv.lib.optional stdenv.isDarwin Security);
+
+  meta = with stdenv.lib; {
+    description = "Find and replace text in source files";
+    homepage = "https://github.com/TankerHQ/ruplacer";
+    license = [ licenses.bsd3 ];
+    maintainers = with maintainers; [ filalex77 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/schema2ldif/default.nix b/nixpkgs/pkgs/tools/text/schema2ldif/default.nix
new file mode 100644
index 000000000000..5df4e90ff1aa
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/schema2ldif/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, makeWrapper, perlPackages }: stdenv.mkDerivation rec {
+  pname = "schema2ldif";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "https://repos.fusiondirectory.org/sources/schema2ldif/schema2ldif-${version}.tar.gz";
+    sha256 = "00cd9xx9g0mnnfn5lvay3vg166z84jla0ya1x34ljdc8bflxsr9a";
+  };
+
+  buildInputs = [ perlPackages.perl ];
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/bin $out/share/man/man1
+
+    cp bin/{schema2ldif,ldap-schema-manager} $out/bin
+    gzip -c man/schema2ldif.1 > $out/share/man/man1/schema2ldif.1.gz
+    gzip -c man/ldap-schema-manager.1 > $out/share/man/man1/ldap-schema-manager.1.gz
+
+    wrapProgram $out/bin/schema2ldif \
+       --prefix PERL5PATH : "${perlPackages.makePerlPath [ perlPackages.GetoptLong ]}"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Utilities to manage schema in .schema and .ldif format";
+    homepage = "https://www.fusiondirectory.org/schema2ldif-project-and-components/";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ das_j ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sd/default.nix b/nixpkgs/pkgs/tools/text/sd/default.nix
new file mode 100644
index 000000000000..a12f07d6da61
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sd/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, rustPlatform, Security
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "sd";
+  version = "0.7.2";
+
+  src = fetchFromGitHub {
+    owner = "chmln";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "15siv3p22v7lj37b74pjsy360qx97d40q2xdzdg2srbi8svjgg27";
+  };
+
+  cargoSha256 = "1sa7ki7kyg98l2gcrdzk7182ghm1clyqljjb596mhzh48g8kddn5";
+
+  buildInputs = stdenv.lib.optionals stdenv.isDarwin [ Security ];
+
+  meta = with stdenv.lib; {
+    description = "Intuitive find & replace CLI (sed alternative)";
+    homepage = "https://github.com/chmln/sd";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.amar1729 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sgml/jade/default.nix b/nixpkgs/pkgs/tools/text/sgml/jade/default.nix
new file mode 100644
index 000000000000..f4110ed21052
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sgml/jade/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, gnum4 }:
+
+stdenv.mkDerivation rec {
+  name = "jade-${version}-${debpatch}";
+  version = "1.2.1";
+  debpatch = "47.3";
+
+  src = fetchurl {
+    url = "ftp://ftp.jclark.com/pub/jade/jade-${version}.tar.gz";
+    sha256 = "84e2f8a2a87aab44f86a46b71405d4f919b219e4c73e03a83ab6c746a674b187";
+  };
+
+  patchsrc =  fetchurl {
+    url = "http://ftp.debian.org/debian/pool/main/j/jade/jade_${version}-${debpatch}.diff.gz";
+    sha256 = "8e94486898e3503308805f856a65ba5b499a6f21994151270aa743de48305464";
+  };
+
+  patches = [ patchsrc ];
+
+  buildInputs = [ gnum4 ];
+
+  NIX_CFLAGS_COMPILE = "-Wno-deprecated";
+
+  preInstall = ''
+    install -d -m755 "$out"/lib
+  '';
+
+  postInstall = ''
+    mv "$out/bin/sx" "$out/bin/sgml2xml"
+  '';
+
+  meta = {
+    description = "James Clark's DSSSL Engine";
+    license = "custom";
+    homepage = "http://www.jclark.com/jade/";
+    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [ e-user ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sgml/openjade/default.nix b/nixpkgs/pkgs/tools/text/sgml/openjade/default.nix
new file mode 100644
index 000000000000..eee5d005c058
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sgml/openjade/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, opensp, perl }:
+
+stdenv.mkDerivation rec {
+  name = "openjade-1.3.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/openjade/${name}.tar.gz";
+    sha256 = "1l92sfvx1f0wmkbvzv1385y1gb3hh010xksi1iyviyclrjb7jb8x";
+  };
+
+  patches = [ ./msggen.patch ];
+
+  buildInputs = [ opensp perl ];
+
+  configureFlags = [
+    "--enable-spincludedir=${opensp}/include/OpenSP"
+    "--enable-splibdir=${opensp}/lib"
+  ];
+
+  meta = {
+    description = "An implementation of DSSSL, an ISO standard for formatting SGML (and XML) documents";
+    license = stdenv.lib.licenses.mit;
+    homepage = "http://openjade.sourceforge.net/";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sgml/openjade/msggen.patch b/nixpkgs/pkgs/tools/text/sgml/openjade/msggen.patch
new file mode 100644
index 000000000000..d59573fa49cf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sgml/openjade/msggen.patch
@@ -0,0 +1,34 @@
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-text/openjade/files/openjade-1.3.2-msggen.pl.patch?revision=1.2
+
+Use Getopt::Std in place of getopts.pl.
+https://bugs.gentoo.org/show_bug.cgi?id=420083
+
+--- a/msggen.pl
++++ b/msggen.pl
+@@ -4,6 +4,7 @@
+ # See the file COPYING for copying permission.
+ 
+ use POSIX;
++use Getopt::Std;
+ 
+ # Package and version.
+ $package = 'openjade';
+@@ -18,8 +19,7 @@
+ undef $opt_l;
+ undef $opt_p;
+ undef $opt_t;
+-do 'getopts.pl';
+-&Getopts('l:p:t:');
++getopts('l:p:t:');
+ $module = $opt_l;
+ $pot_file = $opt_p;
+ 
+@@ -72,7 +72,7 @@
+     else {
+ 	$field[0] =~ /^[IWQXE][0-9]$/ || &error("invalid first field");;
+ 	$type[$num] = substr($field[0], 0, 1);
+-	$argc = int(substr($field[0], 1, 1));
++	$argc = substr($field[0], 1, 1);
+     }
+     $nargs[$num] = $argc;
+     $field[1] =~ /^[a-zA-Z_][a-zA-Z0-9_]+$/ || &error("invalid tag");
diff --git a/nixpkgs/pkgs/tools/text/sgml/opensp/default.nix b/nixpkgs/pkgs/tools/text/sgml/opensp/default.nix
new file mode 100644
index 000000000000..9880564d9692
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sgml/opensp/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, fetchpatch, xmlto, docbook_xml_dtd_412
+, libxslt, docbook_xsl, autoconf, automake, gettext, libiconv, libtool}:
+
+stdenv.mkDerivation {
+  name = "opensp-1.5.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/openjade/OpenSP-1.5.2.tar.gz";
+    sha256 = "1khpasr6l0a8nfz6kcf3s81vgdab8fm2dj291n5r2s53k228kx2p";
+  };
+
+  postPatch = ''
+    sed -i s,/usr/share/sgml/docbook/xml-dtd-4.1.2/,${docbook_xml_dtd_412}/xml/dtd/docbook/, \
+      docsrc/*.xml
+  '';
+
+  patches = [
+    (fetchpatch {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-text/opensp/files/opensp-1.5.2-c11-using.patch?id=688d9675782dfc162d4e6cff04c668f7516118d0";
+      sha256 = "04q14s8qsad0bkjmj067dn831i0r6v7742rafdlnbfm5y249m2q6";
+    })
+  ];
+  
+  setupHook = ./setup-hook.sh;
+
+  postFixup = ''
+    # Remove random ids in the release notes
+    sed -i -e 's/href="#idm.*"//g' $out/share/doc/OpenSP/releasenotes.html
+    sed -i -e 's/name="idm.*"//g' $out/share/doc/OpenSP/releasenotes.html
+    '';
+
+  preConfigure = if stdenv.isCygwin then "autoreconf -fi" else null;
+
+  # need autoconf, automake, gettext, and libtool for reconfigure
+  nativeBuildInputs = stdenv.lib.optionals stdenv.isCygwin [ autoconf automake libtool ];
+
+  buildInputs = [ xmlto docbook_xml_dtd_412 libxslt docbook_xsl gettext libiconv ];
+
+  doCheck = false; # fails
+
+  meta = {
+    description = "A suite of SGML/XML processing tools";
+    license = stdenv.lib.licenses.mit;
+    homepage = "http://openjade.sourceforge.net/";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sgml/opensp/setup-hook.sh b/nixpkgs/pkgs/tools/text/sgml/opensp/setup-hook.sh
new file mode 100644
index 000000000000..5bace3c66889
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sgml/opensp/setup-hook.sh
@@ -0,0 +1,22 @@
+addSGMLCatalogs () {
+      if test -d $1/sgml/dtd; then
+          for i in $(find $1/sgml/dtd -name docbook.cat); do
+              export SGML_CATALOG_FILES="${SGML_CATALOG_FILES:+:}$i"
+          done
+      fi
+}
+
+if test -z "${sgmlHookDone-}"; then
+    sgmlHookDone=1
+
+    # Set http_proxy and ftp_proxy to a invalid host to prevent
+    # xmllint and xsltproc from trying to download DTDs from the
+    # network even when --nonet is not given.  That would be impure.
+    # (Note that .invalid is a reserved domain guaranteed not to
+    # work.)
+    export http_proxy=http://nodtd.invalid/
+    export ftp_proxy=http://nodtd.invalid/
+
+    export SGML_CATALOG_FILES
+    addEnvHooks "$targetOffset" addSGMLCatalogs
+fi
diff --git a/nixpkgs/pkgs/tools/text/shab/default.nix b/nixpkgs/pkgs/tools/text/shab/default.nix
new file mode 100644
index 000000000000..b5bb98e5f4d2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/shab/default.nix
@@ -0,0 +1,73 @@
+{ bash, stdenv, lib, runCommand, writeText, fetchFromGitHub }:
+let
+  version = "1.0.0";
+
+  shab = stdenv.mkDerivation {
+    pname = "shab";
+    inherit version;
+
+    src = fetchFromGitHub {
+      owner = "zimbatm";
+      repo = "shab";
+      rev = "v${version}";
+      sha256 = "02lf1s6plhhcfyj9xha44wij9jbphb1x5q55xj3b5bx2ji2jsvji";
+    };
+
+    postPatch = ''
+      for f in test.sh test/*.sh; do
+        patchShebangs "$f"
+      done
+    '';
+
+    doCheck = true;
+    doInstallCheck = true;
+
+    checkPhase = ''
+      ./test.sh
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      cp ./shab $out/bin/shab
+    '';
+
+    installCheckPhase = ''
+      [[ "$(echo 'Hello $entity' | entity=world $out/bin/shab)" == 'Hello world' ]]
+    '';
+
+    passthru = {
+      inherit render renderText;
+    };
+
+    meta = with lib; {
+      description = "The bash templating language";
+      homepage = "https://github.com/zimbatm/shab";
+      license = licenses.unlicense;
+      maintainers = with maintainers; [ zimbatm ];
+      platforms = bash.meta.platforms;
+    };
+  };
+
+  /*
+     shabScript:       a path or filename to use as a template
+     parameters.name:  the name to use as part of the store path
+     parameters:       variables to expose to the template
+   */
+  render = shabScript: parameters:
+    let extraParams = {
+          inherit shabScript;
+        };
+    in runCommand "out" (parameters // extraParams) ''
+      ${shab}/bin/shab "$shabScript" >$out
+    '';
+
+  /*
+     shabScriptText:   a string to use as a template
+     parameters.name:  the name to use as part of the store path
+     parameters:       variables to expose to the template
+   */
+  renderText = shabScriptText: parameters:
+    render (writeText "template" shabScriptText) parameters;
+
+in
+  shab
diff --git a/nixpkgs/pkgs/tools/text/shfmt/default.nix b/nixpkgs/pkgs/tools/text/shfmt/default.nix
new file mode 100644
index 000000000000..71f79724b9cb
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/shfmt/default.nix
@@ -0,0 +1,28 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+
+buildGoModule rec {
+  pname = "shfmt";
+  version = "3.1.0";
+
+  src = fetchFromGitHub {
+    owner = "mvdan";
+    repo = "sh";
+    rev = "v${version}";
+    sha256 = "1k0bq4b4rv6wrh24jvcnpg1mfqrzqhl90zg4zibxzv3zkhjdskzh";
+  };
+
+  modSha256 = "080k8d5rp8kyg0x7vjxm758b9ya9z336yd4rcqws7yhqawxiv55z";
+  subPackages = ["cmd/shfmt"];
+
+  buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
+
+  meta = with lib; {
+    homepage = "https://github.com/mvdan/sh";
+    description = "A shell parser and formatter";
+    longDescription = ''
+      shfmt formats shell programs. It can use tabs or any number of spaces to indent.
+      You can feed it standard input, any number of files or any number of directories to recurse into.
+    '';
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/shocco/default.nix b/nixpkgs/pkgs/tools/text/shocco/default.nix
new file mode 100644
index 000000000000..65adfc29b95a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/shocco/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, perlPackages, pythonPackages }:
+
+stdenv.mkDerivation rec {
+  pname = "shocco";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "rtomayko";
+    repo = "shocco";
+    rev = version;
+    sha256 = "1nkwcw9fqf4vyrwidqi6by7nrmainkjqkirkz3yxmzk6kzwr38mi";
+  };
+
+  prePatch = ''
+    # Don't change $PATH
+    substituteInPlace configure --replace PATH= NIRVANA=
+  '';
+
+  buildInputs = [ perlPackages.TextMarkdown pythonPackages.pygments ];
+
+  meta = with stdenv.lib; {
+    description = "A quick-and-dirty, literate-programming-style documentation generator for / in POSIX shell";
+    homepage = "https://rtomayko.github.io/shocco/";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ dotlambda ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sift/default.nix b/nixpkgs/pkgs/tools/text/sift/default.nix
new file mode 100644
index 000000000000..830810a84c43
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sift/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "sift";
+  version = "0.9.0";
+  rev = "v${version}";
+
+  goPackagePath = "github.com/svent/sift";
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner = "svent";
+    repo = "sift";
+    sha256 = "0bgy0jf84z1c3msvb60ffj4axayfchdkf0xjnsbx9kad1v10g7i1";
+  };
+
+  goDeps = ./deps.nix;
+
+  meta = with lib; {
+    description = "sift is a fast and powerful alternative to grep";
+    homepage = "https://sift-tool.org";
+    maintainers = [ maintainers.carlsverre ];
+    license = licenses.gpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/sift/deps.nix b/nixpkgs/pkgs/tools/text/sift/deps.nix
new file mode 100644
index 000000000000..038555fa3cab
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/sift/deps.nix
@@ -0,0 +1,29 @@
+[
+  {
+    goPackagePath = "golang.org/x/crypto";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/crypto";
+      rev = "575fdbe86e5dd89229707ebec0575ce7d088a4a6";
+      sha256 = "1kgv1mkw9y404pk3lcwbs0vgl133mwyp294i18jg9hp10s5d56xa";
+    };
+  }
+  {
+    goPackagePath = "github.com/svent/go-flags";
+    fetch = {
+      type = "git";
+      url = "https://github.com/svent/go-flags";
+      rev = "4bcbad344f0318adaf7aabc16929701459009aa3";
+      sha256 = "1gb416fgxl9gq4q6wsv3i2grq1mzbi7lvfvmfdqbxqbv9vizzh34";
+    };
+  }
+  {
+    goPackagePath = "github.com/svent/go-nbreader";
+    fetch = {
+      type = "git";
+      url = "https://github.com/svent/go-nbreader";
+      rev = "7cef48da76dca6a496faa7fe63e39ed665cbd219";
+      sha256 = "0hw11jj5r3f6qwydg41nc3c6aadlbkhc1qpxra2609lis0qa9h4r";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/text/silver-searcher/bash-completion.patch b/nixpkgs/pkgs/tools/text/silver-searcher/bash-completion.patch
new file mode 100644
index 000000000000..30e8c72389b7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/silver-searcher/bash-completion.patch
@@ -0,0 +1,5 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -9 +9 @@
+-bashcompdir = $(pkgdatadir)/completions
++bashcompdir = $(datadir)/bash-completion/completions
diff --git a/nixpkgs/pkgs/tools/text/silver-searcher/default.nix b/nixpkgs/pkgs/tools/text/silver-searcher/default.nix
new file mode 100644
index 000000000000..51003694203f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/silver-searcher/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, pcre, zlib, lzma}:
+
+stdenv.mkDerivation rec {
+  pname = "silver-searcher";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "ggreer";
+    repo = "the_silver_searcher";
+    rev = version;
+    sha256 = "0cyazh7a66pgcabijd27xnk1alhsccywivv6yihw378dqxb22i1p";
+  };
+
+  patches = [ ./bash-completion.patch ];
+
+  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ pcre zlib lzma ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/ggreer/the_silver_searcher/";
+    description = "A code-searching tool similar to ack, but faster";
+    maintainers = with maintainers; [ madjar ];
+    platforms = platforms.all;
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/smu/default.nix b/nixpkgs/pkgs/tools/text/smu/default.nix
new file mode 100644
index 000000000000..50bceb4fcb34
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/smu/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "smu";
+  version = "1.5";
+
+  src = fetchFromGitHub {
+    owner = "Gottox";
+    repo = "smu";
+    rev = "v${version}";
+    sha256 = "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc";
+  };
+
+  # _FORTIFY_SOURCE requires compiling with optimization (-O)
+  NIX_CFLAGS_COMPILE = "-O";
+
+  makeFlags = [
+    "PREFIX=${placeholder "out"}"
+  ];
+
+  meta = with lib; {
+    description = "simple markup - markdown like syntax";
+    homepage = "https://github.com/Gottox/smu";
+    license = licenses.mit;
+    maintainers = with maintainers; [ geistesk ];
+  };
+}
+
diff --git a/nixpkgs/pkgs/tools/text/snippetpixie/default.nix b/nixpkgs/pkgs/tools/text/snippetpixie/default.nix
new file mode 100644
index 000000000000..d2116ced5e28
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/snippetpixie/default.nix
@@ -0,0 +1,93 @@
+{ stdenv
+, fetchFromGitHub
+, meson
+, ninja
+, vala
+, pkgconfig
+, wrapGAppsHook
+, appstream
+, desktop-file-utils
+, python3
+, libgee
+, glib
+, gtk3
+, sqlite
+, at-spi2-atk
+, at-spi2-core
+, dbus
+, ibus
+, json-glib
+, pantheon
+, libwnck3
+, xorg
+}:
+
+stdenv.mkDerivation rec {
+  pname = "snippetpixie";
+  version = "1.3.1";
+
+  src = fetchFromGitHub {
+    owner = "bytepixie";
+    repo = pname;
+    rev = version;
+    sha256 = "0cnx7snw3h7p77fhihvqxb6bgg4s2ffvjr8nbymb4bnqlg2a7v97";
+  };
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    vala
+    pkgconfig
+    wrapGAppsHook
+    appstream
+    desktop-file-utils
+    python3
+  ];
+
+  buildInputs = [
+    libgee
+    glib
+    gtk3
+    sqlite
+    at-spi2-atk
+    at-spi2-core
+    dbus
+    ibus
+    json-glib
+    libwnck3
+    xorg.libXtst
+    pantheon.granite
+    pantheon.elementary-gtk-theme
+    pantheon.elementary-icon-theme
+  ];
+
+  doCheck = true;
+
+  postPatch = ''
+    chmod +x meson/post_install.py
+    patchShebangs meson/post_install.py
+  '';
+
+  passthru = {
+    updateScript = pantheon.updateScript {
+      attrPath = pname;
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Your little expandable text snippet helper";
+    longDescription = ''
+      Your little expandable text snippet helper.
+
+      Save your often used text snippets and then expand them whenever you type their abbreviation.
+
+      For example:- "spr`" expands to "Snippet Pixie rules!"
+    '';
+    homepage = "https://www.snippetpixie.com";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [
+      ianmjones
+    ] ++ pantheon.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/source-highlight/default.nix b/nixpkgs/pkgs/tools/text/source-highlight/default.nix
new file mode 100644
index 000000000000..7052d9e5a44a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/source-highlight/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, boost }:
+
+let
+  name = "source-highlight";
+  version = "3.1.9";
+in
+stdenv.mkDerivation {
+  name = "${name}-${version}";
+
+  src = fetchurl {
+    url = "mirror://gnu/src-highlite/${name}-${version}.tar.gz";
+    sha256 = "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs";
+  };
+
+  buildInputs = [ boost ];
+
+  configureFlags = [ "--with-boost=${boost.out}" ];
+
+  enableParallelBuilding = false;
+
+  meta = {
+    description = "Source code renderer with syntax highlighting";
+    homepage = "https://www.gnu.org/software/src-highlite/";
+    license = stdenv.lib.licenses.gpl3Plus;
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    longDescription =
+      ''
+        GNU Source-highlight, given a source file, produces a document
+        with syntax highlighting.
+      '';
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/tab/default.nix b/nixpkgs/pkgs/tools/text/tab/default.nix
new file mode 100644
index 000000000000..f7796c8a3291
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/tab/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromBitbucket, python2 }:
+
+stdenv.mkDerivation rec {
+  version = "7.2";
+  pname = "tab";
+
+  src = fetchFromBitbucket {
+    owner = "tkatchev";
+    repo = pname;
+    rev = version;
+    sha256 = "1bm15lw0vp901dj2vsqx6yixmn7ls3brrzh1w6zgd1ksjzlm5aax";
+  };
+
+  nativeBuildInputs = [ python2 ];
+
+  doCheck = true;
+
+  checkTarget = "test";
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm555 -t $out/bin tab
+    install -Dm444 -t $out/share/doc/tab docs/*.html
+
+    runHook postInstall
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Programming language/shell calculator";
+    homepage    = "https://tkatchev.bitbucket.io/tab/";
+    license     = licenses.boost;
+    maintainers = with maintainers; [ mstarzyk ];
+    platforms   = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/transifex-client/default.nix b/nixpkgs/pkgs/tools/text/transifex-client/default.nix
new file mode 100644
index 000000000000..403adaf71b6f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/transifex-client/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, buildPythonApplication, fetchPypi
+, python-slugify, requests, urllib3, six, setuptools }:
+
+buildPythonApplication rec {
+  pname = "transifex-client";
+  version = "0.13.6";
+
+  propagatedBuildInputs = [
+    urllib3 requests python-slugify six setuptools
+  ];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0y6pprlmkmi7wfqr3k70sb913qa70p3i90q5mravrai7cr32y1w8";
+  };
+
+  prePatch = ''
+    substituteInPlace requirements.txt --replace "urllib3<1.24" "urllib3>=1.24" \
+      --replace "six==1.11.0" "six>=1.11.0" \
+      --replace "python-slugify==1.2.6" "python-slugify>=1.2.6"
+  '';
+
+  # Requires external resources
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.transifex.com/";
+    license = licenses.gpl2;
+    description = "Transifex translation service client";
+    maintainers = [ maintainers.etu ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/txt2tags/default.nix b/nixpkgs/pkgs/tools/text/txt2tags/default.nix
new file mode 100644
index 000000000000..f70ad1710e29
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/txt2tags/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, python }:
+
+stdenv.mkDerivation rec {
+  version = "2.6";
+  pname = "txt2tags";
+
+  dontBuild = true;
+
+  # Python script, needs the interpreter
+  propagatedBuildInputs = [ python ];
+
+  installPhase = ''
+    mkdir -p "$out/bin"
+    mkdir -p "$out/share/doc"
+    mkdir -p "$out/share/man/man1/"
+    sed '1s|/usr/bin/env python|${python}/bin/python|' < txt2tags > "$out/bin/txt2tags"
+    chmod +x "$out/bin/txt2tags"
+    gzip - < doc/manpage.man > "$out/share/man/man1/txt2tags.1.gz"
+    cp doc/userguide.pdf "$out/share/doc"
+    cp -r extras/ samples/ test/ "$out/share"
+  '';
+
+  src = fetchurl {
+    url = "http://txt2tags.googlecode.com/files/${pname}-${version}.tgz";
+    sha256 = "0p5hql559pk8v5dlzgm75yrcxwvz4z30f1q590yzng0ghvbnf530";
+  };
+
+  meta = {
+    homepage = "https://txt2tags.org/";
+    description = "A KISS markup language";
+    license  = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ kovirobi ];
+    platforms = with stdenv.lib.platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/uni2ascii/default.nix b/nixpkgs/pkgs/tools/text/uni2ascii/default.nix
new file mode 100644
index 000000000000..d6b1215caf39
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/uni2ascii/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "uni2ascii-4.18";
+  src = fetchurl {
+    url = "https://billposer.org/Software/Downloads/${name}.tar.gz";
+    sha256 = "03lklnzr6ngs4wqiqa7rifd246f441gfvardbsaa5l6fn9pbn94y";
+  };
+
+  meta = {
+    license = stdenv.lib.licenses.gpl3;
+    homepage = "http://billposer.org/Software/uni2ascii.html";
+    description = "Converts between UTF-8 and many 7-bit ASCII equivalents and back";
+
+    longDescription = '' 
+    This package provides conversion in both directions between UTF-8
+    Unicode and more than thirty 7-bit ASCII equivalents, including
+    RFC 2396 URI format and RFC 2045 Quoted Printable format, the
+    representations used in HTML, SGML, XML, OOXML, the Unicode
+    standard, Rich Text Format, POSIX portable charmaps, POSIX locale
+    specifications, and Apache log files, and the escapes used for
+    including Unicode in Ada, C, Common Lisp, Java, Pascal, Perl,
+    Postscript, Python, Scheme, and Tcl.
+
+    Such ASCII equivalents are useful when including Unicode text in
+    program source, when debugging, and when entering text into web
+    programs that can handle the Unicode character set but are not
+    8-bit safe. For example, MovableType, the blog software, truncates
+    posts as soon as it encounters a byte with the high bit
+    set. However, if Unicode is entered in the form of HTML numeric
+    character entities, Movable Type will not garble the post.
+
+    It also provides ways of converting non-ASCII characters to
+    similar ASCII characters, e.g. by stripping diacritics.
+    '';
+    maintainers = with stdenv.lib.maintainers; [ goibhniu ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/unoconv/default.nix b/nixpkgs/pkgs/tools/text/unoconv/default.nix
new file mode 100644
index 000000000000..f4ee581d11d7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/unoconv/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, python3, libreoffice-unwrapped, asciidoc, makeWrapper
+# whether to install odt2pdf/odt2doc/... symlinks to unoconv
+, installSymlinks ? true
+}:
+
+# IMPORTANT: unoconv must use the same python version as libreoffice (unless it
+# will not be able to load the pyuno module from libreoffice).
+
+stdenv.mkDerivation rec {
+  pname = "unoconv";
+  version = "0.9.0";
+
+  src = fetchFromGitHub {
+    owner = "unoconv";
+    repo = "unoconv";
+    rev = version;
+    sha256 = "1akx64686in8j8arl6vsgp2n3bv770q48pfv283c6fz6wf9p8fvr";
+  };
+
+  buildInputs = [ asciidoc makeWrapper ];
+
+  preBuild = ''
+    makeFlags=prefix="$out"
+  '';
+
+  postInstall = ''
+    sed -i "s|/usr/bin/env python.*|${python3}/bin/${python3.executable}|" "$out/bin/unoconv"
+    wrapProgram "$out/bin/unoconv" \
+       --set-default UNO_PATH ${libreoffice-unwrapped}/lib/libreoffice/program/
+  '' + (if installSymlinks then ''
+    make install-links prefix="$out"
+  '' else "");
+
+  meta = with stdenv.lib; {
+    description = "Convert between any document format supported by LibreOffice/OpenOffice";
+    homepage = "http://dag.wieers.com/home-made/unoconv/";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/unrtf/default.nix b/nixpkgs/pkgs/tools/text/unrtf/default.nix
new file mode 100644
index 000000000000..752d576701ee
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/unrtf/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, fetchpatch, autoconf, automake, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "unrtf";
+  version = "0.21.9";
+
+  src = fetchurl {
+    url = "https://www.gnu.org/software/unrtf/${pname}-${version}.tar.gz";
+    sha256 = "1pcdzf2h1prn393dkvg93v80vh38q0v817xnbwrlwxbdz4k7i8r2";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2016-10091-0001-convert.c-Use-safe-buffer-size-and-snprintf.patch";
+      url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=849705;filename=0001-convert.c-Use-safe-buffer-size-and-snprintf.patch;msg=20";
+      sha256 = "0s0fjvm3zdm9967sijlipfrwjs0h23n2n8fa6f40xxp8y5qq5a0b";
+    })
+  ];
+
+  nativeBuildInputs = [ autoconf automake ];
+
+  buildInputs = [ libiconv ];
+
+  preConfigure = "./bootstrap";
+
+  outputs = [ "out" "man" ];
+
+  meta = with stdenv.lib; {
+    description = "A converter from Rich Text Format to other formats";
+    longDescription = ''
+      UnRTF converts documents in Rich Text Format to other
+      formats, including HTML, LaTeX, and RTF itself.
+    '';
+    homepage = "https://www.gnu.org/software/unrtf/";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ joachifm ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/untex/default.nix b/nixpkgs/pkgs/tools/text/untex/default.nix
new file mode 100644
index 000000000000..829c4da38493
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/untex/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "untex";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "ftp://ftp.thp.uni-duisburg.de/pub/source/${pname}-${version}.tar.gz";
+    sha256 = "1jww43pl9qvg6kwh4h8imp966fzd62dk99pb4s93786lmp3kgdjv";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  unpackPhase = "tar xf $src";
+  installTargets = [ "install" "install.man" ];
+  installFlags = [ "BINDIR=$(out)/bin" "MANDIR=$(out)/share/man/man1" ];
+  preBuild = ''
+    sed -i '1i#include <stdlib.h>\n#include <string.h>' untex.c
+    mkdir -p $out/bin $out/share/man/man1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A utility which removes LaTeX commands from input";
+    homepage = "https://www.ctan.org/pkg/untex";
+    license = licenses.gpl1;
+    maintainers = with maintainers; [ joachifm ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/vale/default.nix b/nixpkgs/pkgs/tools/text/vale/default.nix
new file mode 100644
index 000000000000..6035c2950a96
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/vale/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "vale";
+  version = "2.0.0";
+
+  subPackages = [ "." ];
+
+  src = fetchFromGitHub {
+    owner  = "errata-ai";
+    repo   = "vale";
+    rev    = "v${version}";
+    sha256 = "068973ayd883kzkxl60lpammf3icjz090nw07kfccvhcf24x07bh";
+  };
+
+  goPackagePath = "github.com/errata-ai/vale";
+
+  buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://errata-ai.gitbook.io/vale/";
+    description = "A syntax-aware linter for prose built with speed and extensibility in mind";
+    license = licenses.mit;
+    maintainers = [ maintainers.marsam ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/wdiff/default.nix b/nixpkgs/pkgs/tools/text/wdiff/default.nix
new file mode 100644
index 000000000000..bec7ba8825dd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/wdiff/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, texinfo, which }:
+
+stdenv.mkDerivation rec {
+  name = "wdiff-1.2.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/wdiff/${name}.tar.gz";
+    sha256 = "0sxgg0ms5lhi4aqqvz1rj4s77yi9wymfm3l3gbjfd1qchy66kzrl";
+  };
+
+  buildInputs = [ texinfo ];
+
+  checkInputs = [ which ];
+
+  meta = {
+    homepage = "https://www.gnu.org/software/wdiff/";
+    description = "Comparing files on a word by word basis";
+    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = [ stdenv.lib.maintainers.eelco ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/wgetpaste/default.nix b/nixpkgs/pkgs/tools/text/wgetpaste/default.nix
new file mode 100644
index 000000000000..9180573541d2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/wgetpaste/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, wget, bash }:
+
+stdenv.mkDerivation rec {
+  version = "2.29";
+  pname = "wgetpaste";
+
+  src = fetchurl {
+    url = "http://wgetpaste.zlin.dk/${pname}-${version}.tar.bz2";
+    sha256 = "1rp0wxr3zy7y2xp3azaadfghrx7g0m138f9qg6icjxkkz4vj9r22";
+  };
+  # currently zsh-autocompletion support is not installed
+
+  prePatch = ''
+    substituteInPlace wgetpaste --replace "/usr/bin/env bash" "${bash}/bin/bash"
+    substituteInPlace wgetpaste --replace "LC_ALL=C wget" "LC_ALL=C ${wget}/bin/wget"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin;
+    cp wgetpaste $out/bin;
+  '';
+
+  meta = {
+    description = "Command-line interface to various pastebins";
+    homepage = "http://wgetpaste.zlin.dk/";
+    license = stdenv.lib.licenses.publicDomain;
+    maintainers = with stdenv.lib.maintainers; [ qknight domenkozar ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xidel/default.nix b/nixpkgs/pkgs/tools/text/xidel/default.nix
new file mode 100644
index 000000000000..fabfdd857107
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xidel/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, dpkg }:
+
+stdenv.mkDerivation rec {
+  pname = "xidel";
+  version = "0.9.6";
+
+  ## Source archive lacks file (manageUtils.sh), using pre-built package for now.
+  #src = fetchurl {
+  #  url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/${name}.src.tar.gz";
+  #  sha256 = "1h5xn16lgzx0s94iyhxa50lk05yf0af44nzm5w5k57615nd82kz2";
+  #};
+
+  src =
+    if stdenv.hostPlatform.system == "x86_64-linux" then
+      fetchurl {
+        url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/xidel_${version}-1_amd64.deb";
+        sha256 = "0hskc74y7p4j1x33yx0w4fvr610p2yimas8pxhr6bs7mb9b300h7";
+      }
+    else if stdenv.hostPlatform.system == "i686-linux" then
+      fetchurl {
+        url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/xidel_${version}-1_i386.deb";
+        sha256 = "07yk5sk1p4jm0jmgjwdm2wq8d2wybi1wkn1qq5j5y03z1pdc3fi6";
+      }
+    else throw "xidel is not supported on ${stdenv.hostPlatform.system}";
+
+  buildInputs = [ dpkg ];
+
+  unpackPhase = ''
+    dpkg-deb -x ${src} ./
+  '';
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p "$out/bin"
+    cp -a usr/* "$out/"
+    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/bin/xidel"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Command line tool to download and extract data from html/xml pages";
+    homepage = "http://videlibri.sourceforge.net/xidel.html";
+    # source contains no license info (AFAICS), but sourceforge says GPLv2
+    license = licenses.gpl2;
+    # more platforms will be supported when we switch to source build
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/basex/basex.svg b/nixpkgs/pkgs/tools/text/xml/basex/basex.svg
new file mode 100644
index 000000000000..9d476cec2ca1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/basex/basex.svg
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg2178"
+   sodipodi:version="0.32"
+   inkscape:version="0.45"
+   width="1568"
+   height="1164"
+   version="1.0"
+   sodipodi:docbase="F:\Uni\Scholl\Research\Conferences\BTW2007\Poster"
+   sodipodi:docname="Logo.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:modified="true">
+  <metadata
+     id="metadata2183">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs2181" />
+  <sodipodi:namedview
+     inkscape:window-height="1150"
+     inkscape:window-width="1143"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     guidetolerance="10.0"
+     gridtolerance="10.0"
+     objecttolerance="10.0"
+     borderopacity="1.0"
+     bordercolor="#666666"
+     pagecolor="#ffffff"
+     id="base"
+     inkscape:zoom="0.64948454"
+     inkscape:cx="784"
+     inkscape:cy="584.00852"
+     inkscape:window-x="412"
+     inkscape:window-y="20"
+     inkscape:current-layer="layer2"
+     showgrid="false"
+     inkscape:object-bbox="true"
+     inkscape:object-points="true"
+     gridempspacing="10" />
+  <g
+     inkscape:groupmode="layer"
+     id="layer2"
+     style="opacity:1">
+    <path
+       style="font-size:1470px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:19.98425102;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;font-family:Clarendo"
+       d="M 628.08008,847.55762 C 613.24569,864.30587 601.88095,879.3791 593.98584,892.77734 C 586.08995,906.17595 582.1422,916.94254 582.14258,925.07715 C 582.1422,937.9972 586.92735,947.08899 596.49805,952.35254 C 606.06796,957.61633 624.49079,960.24816 651.7666,960.24805 L 720.67285,960.24805 L 720.67285,1072.2207 L 207.46484,1072.2207 L 207.46484,960.24805 L 256.27344,960.24805 C 284.9843,960.24816 308.07265,955.94152 325.53857,947.32813 C 343.00426,938.71498 364.89633,919.09586 391.21484,888.4707 L 673.2998,568.34375 L 441.45898,276.92773 C 416.57596,245.82505 393.60723,224.77038 372.55273,213.76367 C 351.4979,202.75868 325.89734,197.25576 295.75098,197.25488 L 245.50684,197.25488 L 245.50684,86 L 767.32813,86 L 767.32813,197.25488 L 699.85742,197.25488 C 685.97999,197.25576 675.45266,199.76796 668.27539,204.7915 C 661.0972,209.81678 657.50834,217.11414 657.50879,226.68359 C 657.50834,233.38365 659.30277,240.20249 662.89209,247.14014 C 666.4805,254.07943 672.58156,262.57308 681.19531,272.62109 L 810.39453,429.81348 L 967.58691,265.44336 C 974.76388,258.26644 980.50606,250.84945 984.81348,243.19238 C 989.11933,235.53697 991.27265,229.07702 991.27344,223.8125 C 991.27265,215.20008 985.88936,208.62049 975.12354,204.07373 C 964.35618,199.5287 948.20629,197.25576 926.67383,197.25488 L 869.25195,197.25488 L 869.25195,86 L 1332.2158,86 L 1332.2158,197.25488 L 1279.1006,197.25488 C 1241.2968,197.25576 1189.8564,233.14439 1124.7793,304.9209 L 1123.3438,306.35645 L 905.8584,544.65723 L 1155.6436,856.1709 C 1194.8808,904.97966 1224.6684,934.52797 1245.0063,944.81592 C 1265.3422,955.10412 1294.412,960.24816 1332.2158,960.24805 L 1376,960.24805 L 1376,1072.2207 L 810.39453,1072.2207 L 810.39453,960.24805 L 877.86523,960.24805 C 901.79032,960.24816 919.25612,958.21447 930.2627,954.14697 C 941.26782,950.07971 946.77074,943.26087 946.77148,933.69043 C 946.77074,926.51284 945.3352,918.97623 942.46484,911.08057 C 939.59302,903.18523 935.28638,895.64861 929.54492,888.4707 L 768.76367,685.34082 L 628.08008,847.55762 z "
+       id="text2175" />
+    <path
+       style="font-size:500px;font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#e00000;fill-opacity:1;stroke:#ffffff;stroke-width:20;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;font-family:Arial Black"
+       d="M 146.16714,395.52869 L 353.19839,395.52869 C 387.70332,395.52904 414.19255,404.07396 432.66616,421.16345 C 451.13913,438.25361 460.37577,459.41244 460.37612,484.64001 C 460.37577,505.79912 453.78398,523.94688 440.60073,539.08337 C 431.81135,549.17472 418.95329,557.14998 402.02651,563.00916 C 427.74234,569.19424 446.66322,579.81434 458.78921,594.86951 C 470.9145,609.92499 476.97732,628.84587 476.97768,651.6322 C 476.97732,670.18697 472.66417,686.8699 464.03823,701.68103 C 455.41158,716.49227 443.61146,728.211 428.63784,736.83728 C 419.36019,742.20839 405.3628,746.11463 386.64565,748.55603 C 361.74306,751.81124 345.22289,753.43884 337.08511,753.43884 L 146.16714,753.43884 L 146.16714,395.52869 z M 257.7394,535.90955 L 305.83511,535.90955 C 323.0875,535.90976 335.09107,532.93939 341.84585,526.99841 C 348.60017,521.05789 351.97744,512.47229 351.97768,501.24158 C 351.97744,490.82517 348.60017,482.68716 341.84585,476.82751 C 335.09107,470.96842 323.33164,468.03874 306.56753,468.03845 L 257.7394,468.03845 L 257.7394,535.90955 z M 257.7394,676.53455 L 314.13589,676.53455 C 333.17863,676.53462 346.60635,673.15735 354.41909,666.40271 C 362.23134,659.64825 366.13758,650.57436 366.13784,639.18103 C 366.13758,628.60173 362.27203,620.0975 354.54116,613.66833 C 346.8098,607.23944 333.26001,604.02493 313.89175,604.02478 L 257.7394,604.02478 L 257.7394,676.53455 z "
+       id="text2205" />
+    <path
+       style="font-size:500px;font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#e00000;fill-opacity:1;stroke:#ffffff;stroke-width:20;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;font-family:Arial Black"
+       d="M 703.69272,694.35681 L 577.71616,694.35681 L 560.38217,753.43884 L 447.34506,753.43884 L 581.86655,395.52869 L 702.47202,395.52869 L 836.9935,753.43884 L 721.27084,753.43884 L 703.69272,694.35681 z M 680.49936,616.96423 L 640.94858,488.30212 L 601.64194,616.96423 L 680.49936,616.96423 z "
+       id="text3180" />
+    <path
+       style="font-size:500px;font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#e00000;fill-opacity:1;stroke:#ffffff;stroke-width:20;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;font-family:Arial Black"
+       d="M 810.90509,641.13416 L 916.1297,634.54236 C 918.40822,651.63231 923.04689,664.65313 930.04572,673.60486 C 941.4388,688.09061 957.71482,695.33344 978.87384,695.33337 C 994.6614,695.33344 1006.8277,691.63064 1015.3729,684.22498 C 1023.9176,676.81946 1028.19,668.23386 1028.1902,658.46814 C 1028.19,649.19091 1024.121,640.89013 1015.9832,633.5658 C 1007.845,626.24171 988.96479,619.3244 959.34259,612.81384 C 910.83987,601.90905 876.25331,587.42339 855.58282,569.35681 C 834.74945,551.29061 824.33279,528.26004 824.33282,500.26501 C 824.33279,481.87337 829.66319,464.49871 840.32404,448.14099 C 850.98479,431.7839 867.01667,418.92584 888.41974,409.56677 C 909.82262,400.20841 939.16015,395.52905 976.43243,395.52869 C 1022.1679,395.52905 1057.0393,404.03327 1081.0467,421.04138 C 1105.0535,438.05017 1119.3358,465.10906 1123.8934,502.21814 L 1019.6453,508.32166 C 1016.8782,492.20864 1011.0595,480.4899 1002.1893,473.16541 C 993.31863,465.84148 981.07092,462.17937 965.44611,462.17908 C 952.58787,462.17937 942.90364,464.90561 936.39337,470.35779 C 929.88282,475.81055 926.62761,482.44303 926.62775,490.25525 C 926.62761,495.95213 929.31316,501.07908 934.68439,505.63611 C 939.89257,510.35641 952.26235,514.75094 971.79376,518.8197 C 1020.1334,529.2366 1054.7606,539.77533 1075.6756,550.43591 C 1096.59,561.09692 1111.8081,574.32119 1121.3299,590.10876 C 1130.851,605.89668 1135.6118,623.55617 1135.6121,643.08728 C 1135.6118,666.03659 1129.2641,687.19543 1116.5692,706.56384 C 1103.8735,725.93237 1086.1327,740.62148 1063.3465,750.63123 C 1040.5598,760.64099 1011.8326,765.64587 977.16486,765.64587 C 916.29234,765.64587 874.13743,753.92713 850.70001,730.48962 C 827.26248,707.05218 813.99752,677.26705 810.90509,641.13416 L 810.90509,641.13416 z "
+       id="text3184" />
+    <path
+       style="font-size:500px;font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#e00000;fill-opacity:1;stroke:#ffffff;stroke-width:20;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;font-family:Arial Black"
+       d="M 1139.0592,395.52869 L 1435.4459,395.52869 L 1435.4459,471.9447 L 1249.899,471.9447 L 1249.899,528.82947 L 1422.0182,528.82947 L 1422.0182,601.82751 L 1249.899,601.82751 L 1249.899,672.38416 L 1440.817,672.38416 L 1440.817,753.43884 L 1139.0592,753.43884 L 1139.0592,395.52869 z "
+       id="text3188" />
+  </g>
+</svg>
diff --git a/nixpkgs/pkgs/tools/text/xml/basex/default.nix b/nixpkgs/pkgs/tools/text/xml/basex/default.nix
new file mode 100644
index 000000000000..4dcaed16bb84
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/basex/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, unzip, jre, coreutils, makeDesktopItem }:
+
+stdenv.mkDerivation rec {
+  pname = "basex";
+  version = "8.6.6";
+
+  src = fetchurl {
+    url = "http://files.basex.org/releases/${version}/BaseX866.zip";
+    sha256 = "1kws6swisdaa17yhijjvkh2ikwz9rd5cw8mdjvkqw6vlcp1nq6m4";
+  };
+
+  buildInputs = [ unzip jre ];
+
+  desktopItem = makeDesktopItem {
+    name = "basex";
+    exec = "basexgui %f";
+    icon = ./basex.svg; # icon copied from Ubuntu basex package
+    comment = "Visually query and analyse your XML data";
+    desktopName = "BaseX XML Database";
+    genericName = "XML database tool";
+    categories = "Development;Utility;Database";
+    mimeType = "text/xml";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p "$out"
+    cp -r * "$out"
+
+    # Remove Windows batch files (unclutter $out/bin)
+    rm -f "$out"/bin/*.bat
+
+    # Move some top-level stuff to $out/share/basex (unclutter $out)
+    mkdir -p "$out/share/basex"
+    mv "$out"/*.txt "$out/share/basex/"
+    mv "$out"/webapp "$out/share/basex/"
+
+    # Remove empty directories
+    rmdir "$out/repo"
+    rmdir "$out/data"
+
+    # Install desktop file
+    mkdir -p "$out/share/applications"
+    cp "$desktopItem"/share/applications/* "$out/share/applications/"
+
+    # Use substitutions instead of wrapper scripts
+    for file in "$out"/bin/*; do
+        sed -i -e "s|/usr/bin/env bash|${stdenv.shell}|" \
+               -e "s|java|${jre}/bin/java|" \
+               -e "s|readlink|${coreutils}/bin/readlink|" \
+               -e "s|dirname|${coreutils}/bin/dirname|" \
+               -e "s|basename|${coreutils}/bin/basename|" \
+               -e "s|echo|${coreutils}/bin/echo|" \
+            "$file"
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "XML database and XPath/XQuery processor";
+    longDescription = ''
+      BaseX is a very fast and light-weight, yet powerful XML database and
+      XPath/XQuery processor, including support for the latest W3C Full Text
+      and Update Recommendations. It supports large XML instances and offers a
+      highly interactive front-end (basexgui). Apart from two local standalone
+      modes, BaseX offers a client/server architecture.
+    '';
+    homepage = "http://basex.org/";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/html-xml-utils/default.nix b/nixpkgs/pkgs/tools/text/xml/html-xml-utils/default.nix
new file mode 100644
index 000000000000..c42ecfc24410
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/html-xml-utils/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, curl, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "html-xml-utils";
+  version = "7.8";
+
+  src = fetchurl {
+    url = "https://www.w3.org/Tools/HTML-XML-utils/${pname}-${version}.tar.gz";
+    sha256 = "0p8df3c6mw879vdi8l63kbdqylkf1is10b067mh9kipgfy91rd4s";
+  };
+
+  buildInputs = [curl libiconv];
+
+  meta = with stdenv.lib; {
+    description = "Utilities for manipulating HTML and XML files";
+    homepage = "http://www.w3.org/Tools/HTML-XML-utils/";
+    license = licenses.w3c;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/jing-trang/default.nix b/nixpkgs/pkgs/tools/text/xml/jing-trang/default.nix
new file mode 100644
index 000000000000..dcf83c736cc4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/jing-trang/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, jre_headless, jdk, ant, saxon }:
+
+stdenv.mkDerivation {
+  pname = "jing-trang";
+  version = "20151127";
+
+  src = fetchFromGitHub {
+    owner = "relaxng";
+    repo = "jing-trang";
+    rev = "47a0cbdaec2d48824b78a1c19879ac7875509598"; # needed to compile with jdk8
+    sha256 = "1hhn52z9mv1x9nyvyqnmzg5yrs2lzm9xac7i15izppv02wp32qha";
+  };
+
+  buildInputs = [ jdk ant saxon ];
+
+  CLASSPATH = "lib/saxon.jar";
+
+  preBuild = "ant";
+
+  installPhase = ''
+    mkdir -p "$out"/{share/java,bin}
+    cp ./build/*.jar "$out/share/java/"
+
+    for tool in jing trang; do
+    cat > "$out/bin/$tool" <<EOF
+    #! $SHELL
+    export JAVA_HOME='${jre_headless}'
+    exec '${jre_headless}/bin/java' -jar '$out/share/java/$tool.jar' "\$@"
+    EOF
+    done
+
+    chmod +x "$out"/bin/*
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A RELAX NG validator in Java";
+    # The homepage is www.thaiopensource.com, but it links to googlecode.com
+    # for downloads and call it the "project site".
+    homepage = "https://www.thaiopensource.com/relaxng/trang.html";
+    platforms = platforms.unix;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/rnv/default.nix b/nixpkgs/pkgs/tools/text/xml/rnv/default.nix
new file mode 100644
index 000000000000..2bc1b6ddddac
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/rnv/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, expat }:
+
+stdenv.mkDerivation rec {
+  pname = "rnv";
+  version = "1.7.11";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/rnv/rnv-${version}.tar.xz";
+    sha256 = "1rlxrkkkp8b5j6lyvnd9z1d85grmwwmdggkxq6yl226nwkqj1faa";
+  };
+
+  buildInputs = [ expat ];
+
+  meta = with stdenv.lib; {
+    description = "Relax NG Compact Syntax validator";
+    homepage = "http://www.davidashen.net/rnv.html";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/rxp/default.nix b/nixpkgs/pkgs/tools/text/xml/rxp/default.nix
new file mode 100644
index 000000000000..c0e2ea1c4e25
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/rxp/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation rec {
+  pname = "rxp";
+  version = "1.5.0";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/r/rxp/rxp_${version}.orig.tar.gz";
+    sha256 = "0y365r36wzj4xn1dzhb03spxljnrx8vwqbiwnnwz4630129gzpm6";
+  };
+
+  meta = {
+    license = stdenv.lib.licenses.gpl2Plus;
+    description = "A validating XML parser written in C";
+    homepage = "http://www.cogsci.ed.ac.uk/~richard/rxp.html";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/xml2/default.nix b/nixpkgs/pkgs/tools/text/xml/xml2/default.nix
new file mode 100644
index 000000000000..8c341855e687
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/xml2/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, libxml2 }:
+
+stdenv.mkDerivation {
+  name = "xml2-0.5";
+
+  src = fetchurl {
+    url = "https://web.archive.org/web/20160427221603/http://download.ofb.net/gale/xml2-0.5.tar.gz";
+    sha256 = "01cps980m99y99cnmvydihga9zh3pvdsqag2fi1n6k2x7rfkl873";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxml2 ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://web.archive.org/web/20160515005047/http://dan.egnor.name:80/xml2";
+    description = "Tools for command line processing of XML, HTML, and CSV";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = [ maintainers.rycee ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/xmlformat/default.nix b/nixpkgs/pkgs/tools/text/xml/xmlformat/default.nix
new file mode 100644
index 000000000000..8dfec26e8116
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/xmlformat/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, perl }:
+stdenv.mkDerivation rec {
+  pname = "xmlformat";
+  version = "1.04";
+
+  src = fetchurl {
+    url = "http://www.kitebird.com/software/xmlformat/xmlformat-${version}.tar.gz";
+    sha256 = "1vwgzn4ha0az7dx0cyc6dx5nywwrx9gxhyh08mvdcq27wjbh79vi";
+  };
+
+  buildInputs = [ perl ];
+  buildPhase = ''
+    patchShebangs ./xmlformat.pl
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ./xmlformat.pl $out/bin/xmlformat
+    cp ./LICENSE $out/
+  '';
+
+  meta = {
+    description = "a configurable formatter (or 'pretty-printer') for XML documents";
+    homepage = "http://www.kitebird.com/software/xmlformat/";
+    license = stdenv.lib.licenses.bsd3;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/xmloscopy/default.nix b/nixpkgs/pkgs/tools/text/xml/xmloscopy/default.nix
new file mode 100644
index 000000000000..2cd7a580ee34
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/xmloscopy/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, lib, makeWrapper, dev_only_shellcheck ? null,
+fetchFromGitHub,
+
+fzf, coreutils, libxml2, libxslt, jing, findutils, gnugrep, gnused,
+docbook5
+}:
+stdenv.mkDerivation rec {
+  pname = "xmloscopy";
+  version = "0.1.3";
+
+  nativeBuildInputs = [
+    makeWrapper
+    dev_only_shellcheck
+  ];
+
+  spath = lib.makeBinPath [
+    fzf
+    coreutils
+    libxml2
+    libxslt
+    jing
+    findutils
+    gnugrep
+    gnused
+  ];
+
+  src = fetchFromGitHub {
+    owner = "grahamc";
+    repo = "xmloscopy";
+    rev = "v${version}";
+    sha256 = "06y5bckrmnq7b5ny2hfvlmdws910jw3xbw5nzy3bcpqsccqnjxrc";
+  };
+
+  installPhase = ''
+    sed -i "s/hard to say/v${version}/" ./xmloscopy
+    type -P shellcheck && shellcheck ./xmloscopy
+    chmod +x ./xmloscopy
+    patchShebangs ./xmloscopy
+    mkdir -p $out/bin
+    cp ./xmloscopy $out/bin/
+    wrapProgram $out/bin/xmloscopy \
+      --set RNG "${docbook5}/xml/rng/docbook/docbook.rng" \
+      --set PATH "${spath}"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "wtf is my docbook broken?";
+    homepage = "https://github.com/grahamc/xmloscopy";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ grahamc ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/xmlstarlet/default.nix b/nixpkgs/pkgs/tools/text/xml/xmlstarlet/default.nix
new file mode 100644
index 000000000000..7d3471f9561c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/xmlstarlet/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, libxml2, libxslt }:
+
+stdenv.mkDerivation rec {
+  name = "xmlstarlet-1.6.1";
+  
+  src = fetchurl {
+    url = "mirror://sourceforge/xmlstar/${name}.tar.gz";
+    sha256 = "1jp737nvfcf6wyb54fla868yrr39kcbijijmjpyk4lrpyg23in0m";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libxml2 libxslt ];
+
+  preConfigure =
+    ''
+      export LIBXSLT_PREFIX=${libxslt.dev}
+      export LIBXML_PREFIX=${libxml2.dev}
+      export LIBXSLT_LIBS=$(pkg-config --libs libxslt libexslt)
+      export LIBXML_LIBS=$(pkg-config --libs libxml-2.0)
+    '';
+
+  postInstall =
+    ''
+      ln -s xml $out/bin/xmlstarlet
+    '';
+
+  meta = {
+    description = "A command line tool for manipulating and querying XML data";
+    homepage = "http://xmlstar.sourceforge.net/";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xml/xpf/default.nix b/nixpkgs/pkgs/tools/text/xml/xpf/default.nix
new file mode 100644
index 000000000000..6999a4a64d03
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xml/xpf/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, python2, libxml2}:
+
+assert libxml2.pythonSupport == true;
+
+stdenv.mkDerivation {
+  name = "xpf-0.2";
+  
+  src = fetchurl {
+    url = "http://tarballs.nixos.org/xpf-0.2.tar.gz";
+    sha256 = "0ljx91w68rnh4871c0xlq2whlmhqz8dr39wcdczfjjpniqz1fmpz";
+  };
+  
+  buildInputs = [ python2 libxml2 ];
+
+  meta = {
+    description = "XML Pipes and Filters - command line tools for manipulating and querying XML data";
+    homepage = "http://www.cs.uu.nl/wiki/bin/view/Martin/XmlPipesAndFilters";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xsv/default.nix b/nixpkgs/pkgs/tools/text/xsv/default.nix
new file mode 100644
index 000000000000..927d0d14be68
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xsv/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, rustPlatform, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "xsv";
+  version = "0.13.0";
+
+  src = fetchFromGitHub {
+    owner = "BurntSushi";
+    repo = "xsv";
+    rev = version;
+    sha256 = "17v1nw36mrarrd5yv4xd3mpc1d7lvhd5786mqkzyyraf78pjg045";
+  };
+
+  cargoSha256 = "1q59nvklh5r2mrsz656z6js3j2l6rqyhfz6l0yq28df5kyahk91b";
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  meta = with stdenv.lib; {
+    description = "A fast CSV toolkit written in Rust";
+    homepage = "https://github.com/BurntSushi/xsv";
+    license = with licenses; [ unlicense /* or */ mit ];
+    maintainers = [ maintainers.jgertm ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/xurls/default.nix b/nixpkgs/pkgs/tools/text/xurls/default.nix
new file mode 100644
index 000000000000..30cc825c6627
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/xurls/default.nix
@@ -0,0 +1,24 @@
+{ buildGoPackage, stdenv, fetchFromGitHub }:
+
+buildGoPackage rec {
+  version = "2.0.0";
+  pname = "xurls";
+
+  src = fetchFromGitHub {
+    owner = "mvdan";
+    repo = "xurls";
+    rev = "v${version}";
+    sha256 = "1jdjwlp19r8cb7vycyrjmpwf8dz2fzrqphq4lkvy9x2v7x0kksx8";
+  };
+
+  goPackagePath = "mvdan.cc/xurls/v2";
+  subPackages = [ "cmd/xurls" ];
+
+  meta = with stdenv.lib; {
+    description = "Extract urls from text";
+    homepage = "https://github.com/mvdan/xurls";
+    maintainers = with maintainers; [ koral ];
+    platforms = platforms.unix;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/yaml-merge/default.nix b/nixpkgs/pkgs/tools/text/yaml-merge/default.nix
new file mode 100644
index 000000000000..b91d24e1137d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/yaml-merge/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, pythonPackages }:
+
+stdenv.mkDerivation {
+  name= "yaml-merge-2016-02-16";
+
+  src = fetchFromGitHub {
+    owner = "abbradar";
+    repo = "yaml-merge";
+    rev = "4eef7b68632d79dec369b4eff5a8c63f995f81dc";
+    sha256 = "0mwda2shk43i6f22l379fcdchmb07fm7nf4i2ii7fk3ihkhb8dgp";
+  };
+
+  pythonPath = with pythonPackages; [ pyyaml ];
+  nativeBuildInputs = [ pythonPackages.wrapPython ];
+
+  installPhase = ''
+    install -Dm755 yaml-merge.py $out/bin/yaml-merge
+    wrapPythonPrograms
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Merge YAML data files";
+    homepage = "https://github.com/abbradar/yaml-merge";
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/zimreader/default.nix b/nixpkgs/pkgs/tools/text/zimreader/default.nix
new file mode 100644
index 000000000000..0b947ee5db36
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/zimreader/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, fetchpatch, automake, autoconf, libtool
+, zimlib, cxxtools, tntnet
+}:
+
+stdenv.mkDerivation {
+  name = "zimreader-0.92";
+
+  src = fetchFromGitHub {
+    owner = "wikimedia";
+    repo = "openzim";
+    rev = "r1.3"; # there multiple tools with different version in the repo
+    sha256 = "0x529137rxy6ld64xqa6xmn93121ripxvkf3sc7hv3wg6km182sw";
+  };
+
+  patchFlags = [ "-p2" ];
+  patches = [
+    (fetchpatch {
+      name = "zimreader_tntnet221.patch";
+      url = "https://github.com/wikimedia/openzim/compare/r1.3...juliendehos:3ee5f11eaa811284d340451e6f466529c00f6ef2.patch";
+      sha256 = "0rc5n20svyyndqh7hsynjyblfraphgi0f6khw6f5jq89w9i1j1hd";
+    })
+  ];
+
+  enableParallelBuilding = true;
+  buildInputs = [ automake autoconf libtool zimlib cxxtools tntnet ];
+  setSourceRoot = ''
+    sourceRoot=$(echo */zimreader)
+  '';
+  preConfigure = "./autogen.sh";
+
+  meta = {
+    description = "A tool to serve ZIM files using HTTP";
+    homepage = "http://git.wikimedia.org/log/openzim";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ robbinch juliendehos ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/text/zimwriterfs/default.nix b/nixpkgs/pkgs/tools/text/zimwriterfs/default.nix
new file mode 100644
index 000000000000..8362280c2fa2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/zimwriterfs/default.nix
@@ -0,0 +1,43 @@
+{ stdenv
+, fetchFromGitHub
+
+, autoconf
+, automake
+, libtool
+, pkgconfig
+
+, file
+, icu
+, gumbo
+, lzma
+, xapian
+, zimlib
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "zimwriterfs";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "wikimedia";
+    repo = "openzim";
+    rev = "${pname}-${version}";
+    sha256 = "1vkrrq929a8s3m5rri1lg0l2vd0mc9n2fsb2z1g88k4n4j2l6f19";
+  };
+
+  nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
+  buildInputs = [ file icu gumbo lzma zimlib zlib xapian ];
+  setSourceRoot = ''
+    sourceRoot=$(echo */zimwriterfs)
+  '';
+  preConfigure = "./autogen.sh";
+
+  meta = {
+    description = "A console tool to create ZIM files";
+    homepage = "http://git.wikimedia.org/log/openzim";
+    maintainers = with stdenv.lib.maintainers; [ robbinch ];
+    license = stdenv.lib.licenses.gpl3;
+    platforms = with stdenv.lib.platforms; [ linux ];
+  };
+}