Fix khelpcenter manpages (#389602)

This commit is contained in:
K900
2025-05-02 07:06:08 +03:00
committed by GitHub
4 changed files with 51 additions and 0 deletions
+11
View File
@@ -1,7 +1,11 @@
{
mkKdeDerivation,
replaceVars,
qtwebengine,
xapian,
man-db,
python3,
kio-extras,
}:
mkKdeDerivation {
pname = "khelpcenter";
@@ -9,6 +13,13 @@ mkKdeDerivation {
extraBuildInputs = [
qtwebengine
xapian
python3
kio-extras
];
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(' '))
@@ -0,0 +1,13 @@
diff --git a/man/kio_man.cpp b/man/kio_man.cpp
index a2fb6dbf5..cb6f373bc 100644
--- a/man/kio_man.cpp
+++ b/man/kio_man.cpp
@@ -868,6 +868,8 @@ void MANProtocol::constructPath(QStringList &constr_path, QStringList constr_cat
mc.setFileName("/etc/manpath.config"); // SuSE, Debian
if (!mc.exists())
mc.setFileName("/etc/man.config"); // Mandrake
+ if (!mc.exists())
+ mc.setFileName("/run/current-system/etc/man_db.conf"); // NixOS
if (mc.open(QIODevice::ReadOnly)) {
QTextStream is(&mc);
+4
View File
@@ -19,6 +19,10 @@
mkKdeDerivation {
pname = "kio-extras";
patches = [
# An upstream merge request is pending for this https://invent.kde.org/network/kio-extras/-/merge_requests/422
./add-nixos-man-db-config-path.patch
];
extraNativeBuildInputs = [
pkg-config
gperf