From e0d5f644ac0b63570f5aa989072e71312cadbb5b Mon Sep 17 00:00:00 2001 From: snaar Date: Sun, 22 Jul 2018 17:03:38 -0400 Subject: [PATCH 1/3] lesspipe: add missing dependency on 'file' --- pkgs/tools/misc/lesspipe/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/misc/lesspipe/default.nix b/pkgs/tools/misc/lesspipe/default.nix index 46324f912c5..25c5e826648 100644 --- a/pkgs/tools/misc/lesspipe/default.nix +++ b/pkgs/tools/misc/lesspipe/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, perl }: +{ stdenv, fetchFromGitHub, perl, file }: stdenv.mkDerivation rec { name = "lesspipe-${version}"; From c6bc77d30e39cc345f36d0c33979819dcb305d2a Mon Sep 17 00:00:00 2001 From: snaar Date: Mon, 23 Jul 2018 14:32:39 -0400 Subject: [PATCH 2/3] lesspipe: add dependency on ncurses; actually pull in deps and put them on path --- pkgs/tools/misc/lesspipe/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/misc/lesspipe/default.nix b/pkgs/tools/misc/lesspipe/default.nix index 25c5e826648..b3433be5829 100644 --- a/pkgs/tools/misc/lesspipe/default.nix +++ b/pkgs/tools/misc/lesspipe/default.nix @@ -1,11 +1,12 @@ -{ stdenv, fetchFromGitHub, perl, file }: +{ stdenv, lib, fetchFromGitHub, makeWrapper, perl, file, ncurses }: stdenv.mkDerivation rec { name = "lesspipe-${version}"; version = "1.82"; - buildInputs = [ perl ]; + buildInputs = [ makeWrapper perl ]; preConfigure = "patchShebangs ."; + preFixupPhases = ["wrapWithDepsPhase"]; src = fetchFromGitHub { owner = "wofr06"; @@ -14,6 +15,10 @@ stdenv.mkDerivation rec { sha256 = "0vb7bpap8vy003ha10hc7hxl17y47sgdnrjpihgqxkn8k0bfqbbq"; }; + wrapWithDepsPhase = '' + wrapProgram $out/bin/lesspipe.sh --prefix PATH ":" ${lib.makeBinPath [ file ncurses ]} + ''; + meta = with stdenv.lib; { description = "A preprocessor for less"; longDescription = '' From 93207805b8e1332f45d49e94010a4d5803166c6e Mon Sep 17 00:00:00 2001 From: snaar Date: Tue, 24 Jul 2018 01:23:17 -0400 Subject: [PATCH 3/3] lesspipe: fix paths via patch and substitution --- pkgs/tools/misc/lesspipe/default.nix | 15 +++++++++------ pkgs/tools/misc/lesspipe/fix-paths.patch | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 pkgs/tools/misc/lesspipe/fix-paths.patch diff --git a/pkgs/tools/misc/lesspipe/default.nix b/pkgs/tools/misc/lesspipe/default.nix index b3433be5829..d5352ec26dc 100644 --- a/pkgs/tools/misc/lesspipe/default.nix +++ b/pkgs/tools/misc/lesspipe/default.nix @@ -1,12 +1,11 @@ -{ stdenv, lib, fetchFromGitHub, makeWrapper, perl, file, ncurses }: +{ stdenv, fetchFromGitHub, substituteAll, perl, file, ncurses }: stdenv.mkDerivation rec { name = "lesspipe-${version}"; version = "1.82"; - buildInputs = [ makeWrapper perl ]; + buildInputs = [ perl ]; preConfigure = "patchShebangs ."; - preFixupPhases = ["wrapWithDepsPhase"]; src = fetchFromGitHub { owner = "wofr06"; @@ -15,9 +14,13 @@ stdenv.mkDerivation rec { sha256 = "0vb7bpap8vy003ha10hc7hxl17y47sgdnrjpihgqxkn8k0bfqbbq"; }; - wrapWithDepsPhase = '' - wrapProgram $out/bin/lesspipe.sh --prefix PATH ":" ${lib.makeBinPath [ file ncurses ]} - ''; + patches = [ + (substituteAll { + src = ./fix-paths.patch; + file = "${file}/bin/file"; + tput = "${ncurses}/bin/tput"; + }) + ]; meta = with stdenv.lib; { description = "A preprocessor for less"; diff --git a/pkgs/tools/misc/lesspipe/fix-paths.patch b/pkgs/tools/misc/lesspipe/fix-paths.patch new file mode 100644 index 00000000000..1bffcf53c82 --- /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 +