diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 9ec7e2f0870d..ef3ea580eb25 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -140,6 +140,9 @@ - Added `dell-bios-fan-control` package and service. +- `openrgb` was updated to 1.0rc2, which now uses Plugin API version 4. + Some existing OpenRGB plugins may be incompatible or require updates. + - We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables. ## Nixpkgs Library {#sec-nixpkgs-release-26.05-lib} diff --git a/nixos/modules/services/hardware/openrgb.nix b/nixos/modules/services/hardware/openrgb.nix index 9d5d598db913..09b9d06201e6 100644 --- a/nixos/modules/services/hardware/openrgb.nix +++ b/nixos/modules/services/hardware/openrgb.nix @@ -59,16 +59,28 @@ in ++ lib.optionals (cfg.motherboard == "intel") [ "i2c-i801" ]; systemd.services.openrgb = { - description = "OpenRGB server daemon"; - after = [ "network.target" ]; + description = "OpenRGB SDK Server"; + after = [ + "network.target" + "lm_sensors.service" + ]; wants = [ "dev-usb.device" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { StateDirectory = "OpenRGB"; WorkingDirectory = "/var/lib/OpenRGB"; - ExecStart = - "${cfg.package}/bin/openrgb --server --server-port ${toString cfg.server.port}" - + lib.optionalString (builtins.isString cfg.startupProfile) " --profile ${lib.escapeShellArg cfg.startupProfile}"; + ExecStart = lib.escapeShellArgs ( + [ + (lib.getExe cfg.package) + "--server" + "--server-port" + cfg.server.port + ] + ++ lib.optionals (lib.isString cfg.startupProfile) [ + "--profile" + cfg.startupProfile + ] + ); Restart = "always"; }; }; diff --git a/pkgs/by-name/op/openrgb-plugin-effects/package.nix b/pkgs/by-name/op/openrgb-plugin-effects/package.nix index 5d29b2e8901d..1d4f77c47537 100644 --- a/pkgs/by-name/op/openrgb-plugin-effects/package.nix +++ b/pkgs/by-name/op/openrgb-plugin-effects/package.nix @@ -2,52 +2,45 @@ lib, stdenv, fetchFromGitLab, - openrgb, glib, openal, + hidapi, + pipewire, pkg-config, - kdePackages, - fetchpatch, + qt6Packages, }: stdenv.mkDerivation (finalAttrs: { pname = "openrgb-plugin-effects"; - version = "0.9"; + version = "1.0rc2"; src = fetchFromGitLab { owner = "OpenRGBDevelopers"; repo = "OpenRGBEffectsPlugin"; - rev = "release_${finalAttrs.version}"; - hash = "sha256-8BnHifcFf7ESJgJi/q3ca38zuIVa++BoGlkWxj7gpog="; + tag = "release_candidate_${finalAttrs.version}"; + hash = "sha256-0W0hO3PSMpPLc0a7g/Nn7GWMcwBXhOxh1Y2flpdcnfE="; fetchSubmodules = true; }; - patches = [ - # Fix Qt6 issues in OpenRGBPluginsFont.cpp - (fetchpatch { - url = "https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectsPlugin/-/commit/e952b0ed390045d4f4adec8e74b3126c2f8abcab.patch"; - hash = "sha256-xMsnVyrn/Cv2x2xQtAnPb5HJc+WolNx4v7h0TkTj9DU="; - }) - ./qt5compat.patch + qmakeFlags = [ + "CONFIG+=link_pkgconfig" + "PKGCONFIG+=libpipewire-0.3" + "QT_TOOL.lrelease.binary=${lib.getDev qt6Packages.qttools}/bin/lrelease" ]; - postPatch = '' - # Use the source of openrgb from nixpkgs instead of the submodule - rm -r OpenRGB - ln -s ${openrgb.src} OpenRGB - ''; - nativeBuildInputs = [ pkg-config - kdePackages.wrapQtAppsHook - kdePackages.qmake + qt6Packages.wrapQtAppsHook + qt6Packages.qmake ]; buildInputs = [ - kdePackages.qtbase - kdePackages.qt5compat + qt6Packages.qtbase + qt6Packages.qt5compat glib openal + hidapi + pipewire ]; meta = { diff --git a/pkgs/by-name/op/openrgb-plugin-effects/qt5compat.patch b/pkgs/by-name/op/openrgb-plugin-effects/qt5compat.patch deleted file mode 100644 index 926c34945419..000000000000 --- a/pkgs/by-name/op/openrgb-plugin-effects/qt5compat.patch +++ /dev/null @@ -1,114 +0,0 @@ -Commit ID: 20f227f4ef942e2ead5a3a684248c2da48c979bc -Change ID: rwlwzspvylkypuqoornwzvuvpuzorvso -Author : Alexey Sokolov (2025-07-21 22:34:37) -Committer: Marie Ramlow (2025-10-12 12:05:01) - - Fix build with Qt6 using core5compat - - Updated to add Qt5 backwards compatibility by Adam Honse - -diff --git a/Effects/Ambient/RectangleSelector.cpp b/Effects/Ambient/RectangleSelector.cpp -index 8f28ddcbcc..d8b4f56a1d 100644 ---- a/Effects/Ambient/RectangleSelector.cpp -+++ b/Effects/Ambient/RectangleSelector.cpp -@@ -1,6 +1,5 @@ - #include "RectangleSelector.h" - #include --#include - #include - - RectangleSelector::RectangleSelector(QWidget* parent) -@@ -57,7 +56,7 @@ - - QPainter painter(this); - -- texture.setDevicePixelRatio(devicePixelRatioF() / qApp->desktop()->devicePixelRatioF()); -+ texture.setDevicePixelRatio(devicePixelRatioF() / qApp->primaryScreen()->devicePixelRatio()); - - painter.setPen(QColor(0, 0, 0, 128)); - painter.setBrush(Qt::NoBrush); -@@ -69,7 +68,7 @@ - for(QScreen *screen : QApplication::screens()) - { - QRect geometry = screen->geometry(); -- qreal ratio = screen->devicePixelRatio() / qApp->desktop()->devicePixelRatioF(); -+ qreal ratio = screen->devicePixelRatio() / qApp->primaryScreen()->devicePixelRatio(); - QRect physical_geometry(geometry.x(), geometry.y(), std::lrint((qreal) geometry.width() * ratio), lrint((qreal) geometry.height() * ratio)); - - if(physical_geometry.contains(rect.center())) -@@ -92,7 +91,7 @@ - for(QScreen *screen : QApplication::screens()) - { - QRect geometry = screen->geometry(); -- qreal ratio = screen->devicePixelRatio() / qApp->desktop()->devicePixelRatioF(); -+ qreal ratio = screen->devicePixelRatio() / qApp->primaryScreen()->devicePixelRatio(); - - screen_geometries.emplace_back(geometry.x(), geometry.y(), - std::lrint((qreal) geometry.width() * ratio), -diff --git a/Effects/Shaders/GLSLHighlighter.h b/Effects/Shaders/GLSLHighlighter.h -index 7e9f21423b..ca9bf42c3c 100644 ---- a/Effects/Shaders/GLSLHighlighter.h -+++ b/Effects/Shaders/GLSLHighlighter.h -@@ -2,6 +2,7 @@ - #define GLSLHIGHLIGHTER_H - - #include -+#include - - class GLSLHighlighter : public QSyntaxHighlighter - { -diff --git a/OpenRGBEffectPage.cpp b/OpenRGBEffectPage.cpp -index 0d6e4ab0fb..4b756cf63c 100644 ---- a/OpenRGBEffectPage.cpp -+++ b/OpenRGBEffectPage.cpp -@@ -38,7 +38,7 @@ - | Extra options and custom widgets | - \*-----------------------------------------------*/ - ui->ExtraOptions->addWidget(effect); -- ui->ExtraOptions->setMargin(0); -+ ui->ExtraOptions->setContentsMargins(0, 0, 0, 0); - effect->setParent(ui->extra_settings); - - InitUi(); -diff --git a/OpenRGBEffectsPlugin.pro b/OpenRGBEffectsPlugin.pro -index 3e53316519..fec852f88c 100644 ---- a/OpenRGBEffectsPlugin.pro -+++ b/OpenRGBEffectsPlugin.pro -@@ -1,4 +1,10 @@ --QT += gui widgets core -+QT += gui widgets core opengl -+ -+if(greaterThan(QT_MAJOR_VERSION, 5)) { -+QT += \ -+ core5compat \ -+} -+ - DEFINES += OPEN_RGB_EFFECTS_PLUGIN_LIBRARY - TEMPLATE = lib - -diff --git a/SaveProfilePopup.cpp b/SaveProfilePopup.cpp -index 7297dad8b7..4fa837235f 100644 ---- a/SaveProfilePopup.cpp -+++ b/SaveProfilePopup.cpp -@@ -2,8 +2,8 @@ - #include "ui_SaveProfilePopup.h" - #include "OpenRGBEffectSettings.h" - --#include --#include -+#include -+#include - - SaveProfilePopup::SaveProfilePopup(QWidget *parent) : - QWidget(parent), -@@ -12,8 +12,8 @@ - ui->setupUi(this); - - // only letters or numbers, - _ and . -- QRegExp re("^[\\w\\-_.]+$"); -- QRegExpValidator *validator = new QRegExpValidator(re, this); -+ QRegularExpression re("^[\\w\\-_.]+$"); -+ QRegularExpressionValidator *validator = new QRegularExpressionValidator(re, this); - ui->filename->setValidator(validator); - - std::vector filenames = OpenRGBEffectSettings::ListProfiles(); diff --git a/pkgs/by-name/op/openrgb-plugin-hardwaresync/package.nix b/pkgs/by-name/op/openrgb-plugin-hardwaresync/package.nix index a5677c591f9f..c95bd80acd94 100644 --- a/pkgs/by-name/op/openrgb-plugin-hardwaresync/package.nix +++ b/pkgs/by-name/op/openrgb-plugin-hardwaresync/package.nix @@ -2,44 +2,32 @@ lib, stdenv, fetchFromGitLab, - openrgb, glib, libgtop, lm_sensors, pkg-config, - kdePackages, - fetchpatch, + qt6Packages, }: stdenv.mkDerivation (finalAttrs: { pname = "openrgb-plugin-hardwaresync"; - version = "0.9"; + version = "1.0rc2"; src = fetchFromGitLab { owner = "OpenRGBDevelopers"; repo = "OpenRGBHardwareSyncPlugin"; - rev = "release_${finalAttrs.version}"; - hash = "sha256-3sQFiqmXhuavce/6v3XBpp6PAduY7t440nXfbfCX9a0="; + tag = "release_candidate_${finalAttrs.version}"; + hash = "sha256-t5NPlmCg0btHpD/hpHSwDRl8LjVoOiT89WoOm3PmhXA="; + fetchSubmodules = true; }; - patches = [ - # Fix Qt 6 build - (fetchpatch { - url = "https://gitlab.com/OpenRGBDevelopers/OpenRGBHardwareSyncPlugin/-/commit/62707c260953fb5ac2bb782595c18791bf54ff97.patch"; - hash = "sha256-xMsnVyrn/Cv2x2xQtAnPb5HJc+WolNx4v7h0TkTj9DU="; - }) - ]; - postPatch = '' - # Use the source of openrgb from nixpkgs instead of the submodule - rmdir OpenRGB - ln -s ${openrgb.src} OpenRGB # Remove prebuilt stuff rm -r dependencies/lhwm-cpp-wrapper ''; buildInputs = [ - kdePackages.qtbase + qt6Packages.qtbase glib libgtop lm_sensors @@ -47,8 +35,8 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ pkg-config - kdePackages.qmake - kdePackages.wrapQtAppsHook + qt6Packages.qmake + qt6Packages.wrapQtAppsHook ]; meta = { diff --git a/pkgs/by-name/op/openrgb/package.nix b/pkgs/by-name/op/openrgb/package.nix index ce3a74baa29f..a014e40cf1f7 100644 --- a/pkgs/by-name/op/openrgb/package.nix +++ b/pkgs/by-name/op/openrgb/package.nix @@ -2,34 +2,41 @@ lib, stdenv, fetchFromGitLab, + fetchpatch, libusb1, hidapi, pkg-config, coreutils, + makeBinaryWrapper, mbedtls, symlinkJoin, - kdePackages, + qt6Packages, }: stdenv.mkDerivation (finalAttrs: { pname = "openrgb"; - version = "0.9"; + version = "1.0rc2"; src = fetchFromGitLab { owner = "CalcProgrammer1"; repo = "OpenRGB"; - rev = "release_${finalAttrs.version}"; - hash = "sha256-XBLj4EfupyeVHRc0pVI7hrXFoCNJ7ak2yO0QSfhBsGU="; + tag = "release_candidate_${finalAttrs.version}"; + hash = "sha256-vdIA9i1ewcrfX5U7FkcRR+ISdH5uRi9fz9YU5IkPKJQ="; }; patches = [ - ./qlist-include.patch + ./system-plugins-env.patch + (fetchpatch { + name = "Install-systemd-service-under-PREFIX.patch"; + url = "https://gitlab.com/CalcProgrammer1/OpenRGB/-/commit/b58b3c0402131918b3b988631f42617020df9346.patch"; + hash = "sha256-q5i5BNjaLbsXSYEXKQOR/cMm5ExckmW1n2r9H0j09T0="; + }) ]; nativeBuildInputs = [ pkg-config ] - ++ (with kdePackages; [ + ++ (with qt6Packages; [ qmake wrapQtAppsHook ]); @@ -39,7 +46,7 @@ stdenv.mkDerivation (finalAttrs: { hidapi mbedtls ] - ++ (with kdePackages; [ + ++ (with qt6Packages; [ qtbase qttools qtwayland @@ -48,7 +55,12 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' patchShebangs scripts/build-udev-rules.sh substituteInPlace scripts/build-udev-rules.sh \ - --replace-fail /bin/chmod "${coreutils}/bin/chmod" + --replace-fail '/usr/bin/env chmod' ${lib.getExe' coreutils "chmod"} + ''; + + postInstall = '' + substituteInPlace "$out/lib/systemd/system/openrgb.service" \ + --replace-fail /usr/bin/openrgb "$out/bin/openrgb" ''; doInstallCheck = true; @@ -57,40 +69,48 @@ stdenv.mkDerivation (finalAttrs: { HOME=$TMPDIR $out/bin/openrgb --help > /dev/null + if grep -R /usr/bin/env "$out/lib/udev/rules.d"; then + echo "Error: udev rules must not reference /usr/bin/env" + exit 1 + fi + runHook postInstallCheck ''; qmakeFlags = [ - "QT_TOOL.lrelease.binary=${lib.getDev kdePackages.qttools}/bin/lrelease" + "QT_TOOL.lrelease.binary=${lib.getDev qt6Packages.qttools}/bin/lrelease" ]; passthru.withPlugins = plugins: - let - pluginsDir = symlinkJoin { - name = "openrgb-plugins"; - paths = plugins; - # Remove all library version symlinks except one, - # or they will result in duplicates in the UI. - # We leave the one pointing to the actual library, usually the most - # qualified one (eg. libOpenRGBHardwareSyncPlugin.so.1.0.0). - postBuild = '' - for f in $out/lib/*; do - if [ "$(dirname $(readlink "$f"))" == "." ]; then - rm "$f" - fi - done - ''; - }; - in - finalAttrs.finalPackage.overrideAttrs (old: { - qmakeFlags = old.qmakeFlags or [ ] ++ [ - # Welcome to Escape Hell, we have backslashes - ''DEFINES+=OPENRGB_EXTRA_PLUGIN_DIRECTORY=\\\""${ - lib.escape [ "\\" "\"" " " ] (toString pluginsDir) - }/lib\\\""'' - ]; - }); + symlinkJoin { + inherit (finalAttrs) version meta; + pname = finalAttrs.pname + "-with-plugins"; + nativeBuildInputs = [ makeBinaryWrapper ]; + paths = [ finalAttrs.finalPackage ] ++ plugins; + postBuild = '' + wrapProgram "$out/bin/openrgb" \ + --set OPENRGB_SYSTEM_PLUGIN_DIRECTORY "$out/lib/openrgb/plugins" + + # Update systemd service to use wrapped package + service_file="$out/lib/systemd/system/openrgb.service" + substitute "$service_file" openrgb.service \ + --replace-fail ${finalAttrs.finalPackage} "$out" + mv --force openrgb.service "$service_file" + + # Check for unhandled references to the base package + if grep \ + --dereference-recursive \ + --binary-files=without-match \ + --fixed-strings \ + ${finalAttrs.finalPackage} \ + "$out" + then + echo "ERROR: unexpected reference to base package" + exit 1 + fi + ''; + }; meta = { description = "Open source RGB lighting control"; diff --git a/pkgs/by-name/op/openrgb/qlist-include.patch b/pkgs/by-name/op/openrgb/qlist-include.patch deleted file mode 100644 index 52fb6772cf71..000000000000 --- a/pkgs/by-name/op/openrgb/qlist-include.patch +++ /dev/null @@ -1,16 +0,0 @@ -Commit ID: 2fa7aa0ec87d9878293033db0e86bb62cddc47df -Change ID: mvrytuwvnokxyvmuworxptmtqpqpppxq -Author : Marie Ramlow (2025-10-11 12:10:21) -Committer: Marie Ramlow (2025-10-11 12:17:20) - - OpenRGBFont: add QList include - -diff --git a/qt/OpenRGBFont.cpp b/qt/OpenRGBFont.cpp -index 628bd35281..db1ab5fb76 100644 ---- a/qt/OpenRGBFont.cpp -+++ b/qt/OpenRGBFont.cpp -@@ -1,3 +1,4 @@ -+#include - #include "OpenRGBFont.h" - #include - diff --git a/pkgs/by-name/op/openrgb/system-plugins-env.patch b/pkgs/by-name/op/openrgb/system-plugins-env.patch new file mode 100644 index 000000000000..6edbff9eb19d --- /dev/null +++ b/pkgs/by-name/op/openrgb/system-plugins-env.patch @@ -0,0 +1,23 @@ +diff --git a/PluginManager.cpp b/PluginManager.cpp +index 157b6cd5..42d9b59d 100644 +--- a/PluginManager.cpp ++++ b/PluginManager.cpp +@@ -59,6 +59,18 @@ void PluginManager::ScanAndLoadPlugins() + filesystem::path plugins_dir = ResourceManager::get()->GetConfigurationDirectory() / plugins_path; + ScanAndLoadPluginsFrom(plugins_dir, false); + ++ /*---------------------------------------------------------*\ ++ | Get the system plugins directory from the environment | ++ | | ++ | Allow setting a system plugin directory during runtime, | ++ | e.g. by Nixpkgs' `withPlugins` wrapper. | ++ \*---------------------------------------------------------*/ ++ const char* system_plugins_dir = std::getenv("OPENRGB_SYSTEM_PLUGIN_DIRECTORY"); ++ if(system_plugins_dir && *system_plugins_dir) ++ { ++ ScanAndLoadPluginsFrom(system_plugins_dir, true); ++ } ++ + #ifdef OPENRGB_SYSTEM_PLUGIN_DIRECTORY + /*---------------------------------------------------------*\ + | Get the system plugins directory |