From c37694ce04bd01d00d358873a192a1e5c1738229 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Mon, 16 Jun 2025 15:59:01 +0200 Subject: [PATCH 1/3] kdePackages.koi: refactor - `rec` -> `finalAttrs` - `rev` -> `tag` - `sha256` -> `hash` - remove meta `with lib;` - add changelog URL --- pkgs/kde/third-party/koi/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/kde/third-party/koi/default.nix b/pkgs/kde/third-party/koi/default.nix index 3a7e8ceda25d..787abe7e8a30 100644 --- a/pkgs/kde/third-party/koi/default.nix +++ b/pkgs/kde/third-party/koi/default.nix @@ -8,19 +8,19 @@ kwidgetsaddons, wrapQtAppsHook, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "koi"; version = "0.4"; src = fetchFromGitHub { owner = "baduhai"; repo = "Koi"; - rev = version; - sha256 = "sha256-ip7e/Sz/l5UiTFUTLJPorPO7NltE2Isij2MCmvHZV40="; + tag = finalAttrs.version; + hash = "sha256-ip7e/Sz/l5UiTFUTLJPorPO7NltE2Isij2MCmvHZV40="; }; # See https://github.com/baduhai/Koi/blob/master/development/Nix%20OS/dev.nix - sourceRoot = "${src.name}/src"; + sourceRoot = "${finalAttrs.src.name}/src"; nativeBuildInputs = [ cmake wrapQtAppsHook @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { kwidgetsaddons ]; - meta = with lib; { + meta = { description = "Scheduling LIGHT/DARK Theme Converter for the KDE Plasma Desktop"; longDescription = '' Koi is a program designed to provide the KDE Plasma Desktop functionality to automatically switch between light and dark themes. Koi is under semi-active development, and while it is stable enough to use daily, expect bugs. Koi is designed to be used with Plasma, and while some features may function under different desktop environments, they are unlikely to work and untested. @@ -47,9 +47,10 @@ stdenv.mkDerivation rec { - Hide application to system tray - Toggle between LIGHT/DARK themes by clicking mouse wheel ''; - license = licenses.lgpl3; - platforms = platforms.linux; + license = lib.licenses.lgpl3; + platforms = lib.platforms.linux; + changelog = "https://github.com/baduhai/Koi/releases/tag/${finalAttrs.version}"; homepage = "https://github.com/baduhai/Koi"; maintainers = with lib.maintainers; [ fnune ]; }; -} +}) From 785f27ea909a79fab0c21dea68309848da7ef14b Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Mon, 16 Jun 2025 16:01:13 +0200 Subject: [PATCH 2/3] kdePackages.koi: 0.4 -> 0.5.1 Changelogs: - https://github.com/baduhai/Koi/releases/tag/0.5.1 - https://github.com/baduhai/Koi/releases/tag/0.5 --- pkgs/kde/third-party/koi/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/kde/third-party/koi/default.nix b/pkgs/kde/third-party/koi/default.nix index 787abe7e8a30..9e1bfd3d62de 100644 --- a/pkgs/kde/third-party/koi/default.nix +++ b/pkgs/kde/third-party/koi/default.nix @@ -10,17 +10,15 @@ }: stdenv.mkDerivation (finalAttrs: { pname = "koi"; - version = "0.4"; + version = "0.5.1"; src = fetchFromGitHub { owner = "baduhai"; repo = "Koi"; tag = finalAttrs.version; - hash = "sha256-ip7e/Sz/l5UiTFUTLJPorPO7NltE2Isij2MCmvHZV40="; + hash = "sha256-fXLGlq41Qwdp0cYJcNqPlYnlpVXsZk0imYxP7Bgdcvw="; }; - # See https://github.com/baduhai/Koi/blob/master/development/Nix%20OS/dev.nix - sourceRoot = "${finalAttrs.src.name}/src"; nativeBuildInputs = [ cmake wrapQtAppsHook From b95aad0ec08d10450ac001043a9500297a97be1f Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Mon, 16 Jun 2025 16:05:36 +0200 Subject: [PATCH 3/3] kdePackages.koi: patch hardcoded binary paths Co-authored-by: alexyao2015 <33379584+alexyao2015@users.noreply.github.com> --- .../koi/0001-locate-plasma-tools.patch | 44 +++++++++++++++++++ pkgs/kde/third-party/koi/default.nix | 25 +++++++++++ 2 files changed, 69 insertions(+) create mode 100644 pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch diff --git a/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch b/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch new file mode 100644 index 000000000000..2f4a8a2a7629 --- /dev/null +++ b/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch @@ -0,0 +1,44 @@ +diff --git a/src/plugins/colorscheme.cpp b/src/plugins/colorscheme.cpp +index 7c51806..4d8015b 100644 +--- a/src/plugins/colorscheme.cpp ++++ b/src/plugins/colorscheme.cpp +@@ -3,16 +3,7 @@ + #include + + void ColorScheme::setTheme(QString themeName) { +- QProcess process; +- QString locateProgram = "whereis"; +- QStringList programToLocate = {"plasma-apply-colorscheme"}; +- +- process.start(locateProgram, programToLocate); +- process.waitForFinished(); +- +- QString program(process.readAllStandardOutput()); +- program.replace("plasma-apply-colorscheme: ", ""); +- program.replace("\n", ""); ++ QString program("@plasma-apply-colorscheme@"); + + QStringList arguments{themeName}; + QProcess::startDetached(program, arguments); +diff --git a/src/plugins/icons.cpp b/src/plugins/icons.cpp +index 1cc306f..745d042 100644 +--- a/src/plugins/icons.cpp ++++ b/src/plugins/icons.cpp +@@ -5,16 +5,7 @@ + void Icons::setTheme(QString iconTheme) { + + // locate plasma-changeicons program +- QProcess process; +- QString locateProgram = "whereis"; +- QStringList programToLocate = {"plasma-changeicons"}; +- +- process.start(locateProgram, programToLocate); +- process.waitForFinished(); +- +- QString program(process.readAllStandardOutput()); +- program.replace("plasma-changeicons: ", ""); +- program.replace("\n", ""); ++ QString program("@plasma-changeicons@"); + + // apply the icon theme + QStringList arguments{iconTheme}; diff --git a/pkgs/kde/third-party/koi/default.nix b/pkgs/kde/third-party/koi/default.nix index 9e1bfd3d62de..3cdc6f2bc066 100644 --- a/pkgs/kde/third-party/koi/default.nix +++ b/pkgs/kde/third-party/koi/default.nix @@ -7,6 +7,10 @@ kcoreaddons, kwidgetsaddons, wrapQtAppsHook, + kdbusaddons, + kde-cli-tools, + plasma-workspace, + qtstyleplugin-kvantum, }: stdenv.mkDerivation (finalAttrs: { pname = "koi"; @@ -19,6 +23,27 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-fXLGlq41Qwdp0cYJcNqPlYnlpVXsZk0imYxP7Bgdcvw="; }; + patches = [ + # koi tries to access KDE utility binaries at their absolute paths or by using `whereis`. + # We patch the absolute paths below in `postPatch` and replace the `whereis` invocations + # here with a placeholder that is also substituted in `postPatch`. + ./0001-locate-plasma-tools.patch + ]; + + postPatch = '' + substituteInPlace src/utils.cpp \ + --replace-fail /usr/bin/kquitapp6 ${lib.getExe' kdbusaddons "kquitapp6"} \ + --replace-fail /usr/bin/kstart ${lib.getExe' kde-cli-tools "kstart"} + substituteInPlace src/plugins/plasmastyle.cpp \ + --replace-fail /usr/bin/plasma-apply-desktoptheme ${lib.getExe' plasma-workspace "plasma-apply-desktoptheme"} + substituteInPlace src/plugins/colorscheme.cpp \ + --replace-fail '@plasma-apply-colorscheme@' ${lib.getExe' plasma-workspace "plasma-apply-colorscheme"} + substituteInPlace src/plugins/icons.cpp \ + --replace-fail '@plasma-changeicons@' ${plasma-workspace}/libexec/plasma-changeicons + substituteInPlace src/plugins/kvantumstyle.cpp \ + --replace-fail /usr/bin/kvantummanager ${lib.getExe' qtstyleplugin-kvantum "kvantummanager"} + ''; + nativeBuildInputs = [ cmake wrapQtAppsHook