about summary refs log tree commit diff
path: root/pkgs/tools/misc
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-07-30 09:46:06 +0100
committerGitHub <noreply@github.com>2018-07-30 09:46:06 +0100
commitc5d1f7723b02238cb9cdbe6e9cac558b5e6fce05 (patch)
treeb2e3ae31f94d61a5aeb2877e3cdb2132c7da3349 /pkgs/tools/misc
parent408bd2b80ed198004311c9bb638e776dafffa908 (diff)
parent93207805b8e1332f45d49e94010a4d5803166c6e (diff)
downloadnixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar.gz
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar.bz2
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar.lz
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar.xz
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.tar.zst
nixlib-c5d1f7723b02238cb9cdbe6e9cac558b5e6fce05.zip
Merge pull request #43985 from snaar/fix-lesspipe-dependency
lesspipe: add missing dependency on 'file'
Diffstat (limited to 'pkgs/tools/misc')
-rw-r--r--pkgs/tools/misc/lesspipe/default.nix10
-rw-r--r--pkgs/tools/misc/lesspipe/fix-paths.patch22
2 files changed, 31 insertions, 1 deletions
diff --git a/pkgs/tools/misc/lesspipe/default.nix b/pkgs/tools/misc/lesspipe/default.nix
index 46324f912c52..d5352ec26dcd 100644
--- a/pkgs/tools/misc/lesspipe/default.nix
+++ b/pkgs/tools/misc/lesspipe/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, perl }:
+{ stdenv, fetchFromGitHub, substituteAll, perl, file, ncurses }:
 
 stdenv.mkDerivation rec {
   name = "lesspipe-${version}";
@@ -14,6 +14,14 @@ stdenv.mkDerivation rec {
     sha256 = "0vb7bpap8vy003ha10hc7hxl17y47sgdnrjpihgqxkn8k0bfqbbq";
   };
 
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      file = "${file}/bin/file";
+      tput = "${ncurses}/bin/tput";
+    })
+  ];
+
   meta = with stdenv.lib; {
     description = "A preprocessor for less";
     longDescription = ''
diff --git a/pkgs/tools/misc/lesspipe/fix-paths.patch b/pkgs/tools/misc/lesspipe/fix-paths.patch
new file mode 100644
index 000000000000..1bffcf53c827
--- /dev/null
+++ b/pkgs/tools/misc/lesspipe/fix-paths.patch
@@ -0,0 +1,22 @@
+--- a/lesspipe.sh.in
++++ b/lesspipe.sh.in
+@@ -48,8 +48,8 @@ if [[ "$LESS_ADVANCED_PREPROCESSOR" = '' ]]; then
+ fi
+ 
+ filecmd() {
+-  file -L -s "$@"
+-  file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z
++  @file@ -L -s "$@"
++  @file@ -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z
+ }
+ 
+ sep=:						# file name separator
+@@ -546,7 +546,7 @@ isfinal() {
+ 
+   # color requires -r or -R when calling less
+   typeset COLOR
+-  if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then
++  if [[ $(@tput@ colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then
+     COLOR="--color=always"
+   fi
+