summary refs log tree commit diff
path: root/pkgs/tools/text/groff
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2017-07-01 18:50:44 -0700
committerAneesh Agrawal <aneeshusa@gmail.com>2017-07-01 18:58:34 -0700
commit111b5eb6377839b9518ea40fba6a71f121574ea1 (patch)
treeeba38c35863c57b1e551dff8bd451ebf8021f61d /pkgs/tools/text/groff
parent3c29fbe72a5a7f0fa1eef1472d9603688dad3341 (diff)
downloadnixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar.gz
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar.bz2
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar.lz
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar.xz
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.tar.zst
nixpkgs-111b5eb6377839b9518ea40fba6a71f121574ea1.zip
groff: Add site.tmac to fix man page coloring
This enables groff to correctly respond to the LESS_TERMCAP_*
environment variables, allowing colorized man pages.

Patch is taken from Arch Linux;
see https://bugs.archlinux.org/task/33760.
Diffstat (limited to 'pkgs/tools/text/groff')
-rw-r--r--pkgs/tools/text/groff/default.nix3
-rw-r--r--pkgs/tools/text/groff/site.tmac16
2 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index aa9ece8955b..4e2f6af0669 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -59,6 +59,9 @@ stdenv.mkDerivation rec {
   postInstall = ''
     rm $doc/share/doc/groff/examples/hdtbl/*color*ps
     find $doc/share/doc/groff/ -type f -print0 | xargs -0 sed -i -e 's/%%CreationDate: .*//'
+    for f in 'man.local' 'mdoc.local'; do
+        cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
+    done
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/text/groff/site.tmac b/pkgs/tools/text/groff/site.tmac
new file mode 100644
index 00000000000..8ef1040ca4a
--- /dev/null
+++ b/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
+.\}