From bf5cf73b0a7f64bca732f876d35186f39ae4de21 Mon Sep 17 00:00:00 2001 From: "J. T. Elscott" <78996170+99jte@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:05:47 -0700 Subject: [PATCH] kdePackages.khelpcenter: fix manpage search Previously the shebang in khc_mansearch.py pointed to /bin/env and caused it to fail; add python3 to the extraBuildInputs to that it gets converted to a nix path. Also get the man-db binaries by their nix path rather than hoping that they're in the runtime PATH. --- pkgs/kde/gear/khelpcenter/default.nix | 9 ++++++++ ...se_nix_paths_for_mansearch_utilities.patch | 23 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/kde/gear/khelpcenter/use_nix_paths_for_mansearch_utilities.patch diff --git a/pkgs/kde/gear/khelpcenter/default.nix b/pkgs/kde/gear/khelpcenter/default.nix index 2348754b71b6..e69cd63a7d53 100644 --- a/pkgs/kde/gear/khelpcenter/default.nix +++ b/pkgs/kde/gear/khelpcenter/default.nix @@ -1,7 +1,10 @@ { mkKdeDerivation, + replaceVars, qtwebengine, xapian, + man-db, + python3, }: mkKdeDerivation { pname = "khelpcenter"; @@ -9,6 +12,12 @@ mkKdeDerivation { extraBuildInputs = [ qtwebengine xapian + python3 + ]; + patches = [ + (replaceVars ./use_nix_paths_for_mansearch_utilities.patch { + inherit man-db; + }) ]; meta.mainProgram = "khelpcenter"; } diff --git a/pkgs/kde/gear/khelpcenter/use_nix_paths_for_mansearch_utilities.patch b/pkgs/kde/gear/khelpcenter/use_nix_paths_for_mansearch_utilities.patch new file mode 100644 index 000000000000..531819730127 --- /dev/null +++ b/pkgs/kde/gear/khelpcenter/use_nix_paths_for_mansearch_utilities.patch @@ -0,0 +1,23 @@ +diff --git a/searchhandlers/khc_mansearch.py b/searchhandlers/khc_mansearch.py +index ce61ed9c..a8c4c653 100755 +--- a/searchhandlers/khc_mansearch.py ++++ b/searchhandlers/khc_mansearch.py +@@ -32,15 +32,15 @@ def main(): + # If the query is a single word, perhaps it is the literal name of the + # command, or a prefix, or a substring + if not ' ' in words: +- results_prefix = subprocess.run(['whatis', '-w', words + '*'], capture_output=True, text=True) ++ results_prefix = subprocess.run(['@man-db@/bin/whatis', '-w', words + '*'], capture_output=True, text=True) + if results_prefix.returncode == 0: + command_results += results_prefix.stdout +- results_substring = subprocess.run(['whatis', '-w', '*' + words + '*'], capture_output=True, text=True) ++ results_substring = subprocess.run(['@man-db@/bin/whatis', '-w', '*' + words + '*'], capture_output=True, text=True) + if results_substring.returncode == 0: + command_results += results_substring.stdout + + # Build the apropos command line +- apropos = ['apropos', '-L', args.lang] ++ apropos = ['@man-db@/bin/apropos', '-L', args.lang] + if args.method == 'and': + apropos.append('--and') + apropos.extend(words.split(' '))