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.
This commit is contained in:
J. T. Elscott
2025-05-01 20:55:56 -07:00
parent d550fdc2fb
commit bf5cf73b0a
2 changed files with 32 additions and 0 deletions
+9
View File
@@ -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";
}
@@ -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(' '))