From f265af55c584fe7786e35e3dbd15de28c0d74c3a Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Fri, 27 Jan 2023 16:29:49 +0800 Subject: [PATCH] kinfocenter: add a bunch of tools for additional info --- pkgs/desktops/plasma-5/default.nix | 2 +- pkgs/desktops/plasma-5/kinfocenter.nix | 62 ----------- .../kinfocenter/0001-tool-paths.patch | 51 +++++++++ .../desktops/plasma-5/kinfocenter/default.nix | 104 ++++++++++++++++++ pkgs/desktops/plasma-5/systemsettings.nix | 1 + 5 files changed, 157 insertions(+), 63 deletions(-) delete mode 100644 pkgs/desktops/plasma-5/kinfocenter.nix create mode 100644 pkgs/desktops/plasma-5/kinfocenter/0001-tool-paths.patch create mode 100644 pkgs/desktops/plasma-5/kinfocenter/default.nix diff --git a/pkgs/desktops/plasma-5/default.nix b/pkgs/desktops/plasma-5/default.nix index 6396b7c6c51..dcc5c7f7cf3 100644 --- a/pkgs/desktops/plasma-5/default.nix +++ b/pkgs/desktops/plasma-5/default.nix @@ -130,7 +130,7 @@ let kdeplasma-addons = callPackage ./kdeplasma-addons.nix { }; kgamma5 = callPackage ./kgamma5.nix { }; khotkeys = callPackage ./khotkeys.nix { }; - kinfocenter = callPackage ./kinfocenter.nix { }; + kinfocenter = callPackage ./kinfocenter { }; kmenuedit = callPackage ./kmenuedit.nix { }; kpipewire = callPackage ./kpipewire.nix { }; kscreen = callPackage ./kscreen.nix { }; diff --git a/pkgs/desktops/plasma-5/kinfocenter.nix b/pkgs/desktops/plasma-5/kinfocenter.nix deleted file mode 100644 index c63d22858a5..00000000000 --- a/pkgs/desktops/plasma-5/kinfocenter.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ mkDerivation -, lib -, extra-cmake-modules -, kdoctools -, qtbase -, kcmutils -, kcompletion -, kconfig -, kconfigwidgets -, kcoreaddons -, kdbusaddons -, kdeclarative -, ki18n -, kiconthemes -, kio -, kirigami2 -, kpackage -, kservice -, kwayland -, kwidgetsaddons -, kxmlgui -, solid -, systemsettings -, libraw1394 -, libGLU -, pciutils -}: - -mkDerivation { - pname = "kinfocenter"; - nativeBuildInputs = [ extra-cmake-modules kdoctools ]; - buildInputs = [ - kcmutils - kcompletion - kconfig - kconfigwidgets - kcoreaddons - kdbusaddons - kdeclarative - ki18n - kiconthemes - kio - kirigami2 - kpackage - kservice - kwayland - kwidgetsaddons - kxmlgui - solid - systemsettings - - libraw1394 - libGLU - pciutils - ]; - preFixup = '' - # fix wrong symlink of infocenter pointing to a 'systemsettings5' binary in - # the same directory, while it is actually located in a completely different - # store path - ln -sf ${lib.getBin systemsettings}/bin/systemsettings5 $out/bin/kinfocenter - ''; -} diff --git a/pkgs/desktops/plasma-5/kinfocenter/0001-tool-paths.patch b/pkgs/desktops/plasma-5/kinfocenter/0001-tool-paths.patch new file mode 100644 index 00000000000..c6cf9bd8d6d --- /dev/null +++ b/pkgs/desktops/plasma-5/kinfocenter/0001-tool-paths.patch @@ -0,0 +1,51 @@ +diff --git a/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in b/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in +index f591b9c..e883212 100644 +--- a/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in ++++ b/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in +@@ -63,6 +63,6 @@ + "Name[x-test]": "xxWindow Managerxx", + "Name[zh_CN]": "窗口管理器" + }, +- "TryExec": "@QtBinariesDir@/qdbus", ++ "TryExec": "@qdbus@", + "X-KDE-KInfoCenter-Category": "graphical_information" + } +diff --git a/Modules/kwinsupportinfo/main.cpp b/Modules/kwinsupportinfo/main.cpp +index 667c079..b727b67 100644 +--- a/Modules/kwinsupportinfo/main.cpp ++++ b/Modules/kwinsupportinfo/main.cpp +@@ -19,7 +19,7 @@ public: + explicit KCMKWinSupportInfo(QObject *parent, const KPluginMetaData &data, const QVariantList &args) + : ConfigModule(parent, data, args) + { +- auto outputContext = new CommandOutputContext(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QStringLiteral("/qdbus"), ++ auto outputContext = new CommandOutputContext(QStringLiteral("@qdbus@"), + {QStringLiteral("org.kde.KWin"), QStringLiteral("/KWin"), QStringLiteral("supportInformation")}, + parent); + qmlRegisterSingletonInstance("org.kde.kinfocenter.kwinsupportinfo.private", 1, 0, "InfoOutputContext", outputContext); +diff --git a/Modules/xserver/kcm_xserver.json b/Modules/xserver/kcm_xserver.json +index 04acd6b..24b8f36 100644 +--- a/Modules/xserver/kcm_xserver.json ++++ b/Modules/xserver/kcm_xserver.json +@@ -130,7 +130,7 @@ + "Name[zh_CN]": "X 服务器", + "Name[zh_TW]": "X 伺服器" + }, +- "TryExec": "xdpyinfo", ++ "TryExec": "@xdpyinfo@", + "X-DocPath": "kinfocenter/graphical.html#xserver", + "X-KDE-KInfoCenter-Category": "graphical_information", + "X-KDE-Keywords": "X,X-Server,XServer,XFree86,Display,VideoCard,System Information", +diff --git a/Modules/xserver/main.cpp b/Modules/xserver/main.cpp +index c406ff7..a261b90 100644 +--- a/Modules/xserver/main.cpp ++++ b/Modules/xserver/main.cpp +@@ -17,7 +17,7 @@ public: + explicit KCMXServer(QObject *parent, const KPluginMetaData &data, const QVariantList &args) + : ConfigModule(parent, data, args) + { +- auto outputContext = new CommandOutputContext(QStringLiteral("xdpyinfo"), {}, parent); ++ auto outputContext = new CommandOutputContext(QStringLiteral("@xdpyinfo@"), {}, parent); + qmlRegisterSingletonInstance("org.kde.kinfocenter.xserver.private", 1, 0, "InfoOutputContext", outputContext); + + auto *about = new KAboutData(QStringLiteral("kcm_xserver"), i18nc("@label kcm name", "X-Server"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL); diff --git a/pkgs/desktops/plasma-5/kinfocenter/default.nix b/pkgs/desktops/plasma-5/kinfocenter/default.nix new file mode 100644 index 00000000000..222e7855826 --- /dev/null +++ b/pkgs/desktops/plasma-5/kinfocenter/default.nix @@ -0,0 +1,104 @@ +{ mkDerivation +, lib +, extra-cmake-modules +, kdoctools +, qtbase +, qttools +, kcmutils +, kcompletion +, kconfig +, kconfigwidgets +, kcoreaddons +, kdbusaddons +, kdeclarative +, ki18n +, kiconthemes +, kio +, kirigami2 +, kpackage +, kservice +, kwayland +, kwidgetsaddons +, kxmlgui +, solid +, systemsettings +, dmidecode +, fwupd +, libraw1394 +, libusb1 +, libGLU +, pciutils +, smartmontools +, util-linux +, vulkan-tools +, wayland-utils +, xdpyinfo +}: + +let + inherit (lib) getBin getExe; + + qdbus = "${getBin qttools}/bin/qdbus"; + +in +mkDerivation { + pname = "kinfocenter"; + + nativeBuildInputs = [ extra-cmake-modules kdoctools ]; + + buildInputs = [ + kcmutils + kcompletion + kconfig + kconfigwidgets + kcoreaddons + kdbusaddons + kdeclarative + ki18n + kiconthemes + kio + kirigami2 + kpackage + kservice + kwayland + kwidgetsaddons + kxmlgui + solid + systemsettings + + dmidecode + fwupd + libraw1394 + libusb1 + libGLU + pciutils + smartmontools + util-linux + vulkan-tools + wayland-utils + xdpyinfo + ]; + + patches = [ + ./0001-tool-paths.patch + ]; + + postPatch = '' + for f in Modules/kwinsupportinfo/{kcm_kwinsupportinfo.json.in,main.cpp}; do + substituteInPlace $f \ + --replace "@qdbus@" "${qdbus}" + done + + for f in Modules/xserver/{kcm_xserver.json,main.cpp}; do + substituteInPlace $f \ + --replace "@xdpyinfo@" "${getExe xdpyinfo}" + done + ''; + + # fix wrong symlink of infocenter pointing to a 'systemsettings5' binary in + # the same directory, while it is actually located in a completely different + # store path + preFixup = '' + ln -sf ${lib.getExe systemsettings} $out/bin/kinfocenter + ''; +} diff --git a/pkgs/desktops/plasma-5/systemsettings.nix b/pkgs/desktops/plasma-5/systemsettings.nix index 94d8f92ac4f..1c438df1b82 100644 --- a/pkgs/desktops/plasma-5/systemsettings.nix +++ b/pkgs/desktops/plasma-5/systemsettings.nix @@ -45,4 +45,5 @@ mkDerivation { plasma-workspace ]; outputs = [ "bin" "dev" "out" ]; + meta.mainProgram = "systemsettings5"; }