diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index c8fe37231dc0..070ecd31851d 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -97,6 +97,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/pkgs/by-name/op/openrgb/package.nix b/pkgs/by-name/op/openrgb/package.nix index b17b02be65b9..a014e40cf1f7 100644 --- a/pkgs/by-name/op/openrgb/package.nix +++ b/pkgs/by-name/op/openrgb/package.nix @@ -2,10 +2,12 @@ lib, stdenv, fetchFromGitLab, + fetchpatch, libusb1, hidapi, pkg-config, coreutils, + makeBinaryWrapper, mbedtls, symlinkJoin, qt6Packages, @@ -13,17 +15,22 @@ 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 = [ @@ -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; @@ -71,31 +83,34 @@ stdenv.mkDerivation (finalAttrs: { 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 |