From 2e03c5e81dd265271234695a4b09cc9ed12e8bff Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 16 Dec 2022 14:33:24 +0100 Subject: [PATCH 1/4] openrgb-plugin-hardwaresync: init at 0.8 --- .../openrgb-plugins/hardwaresync/default.nix | 67 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 69 insertions(+) create mode 100644 pkgs/applications/misc/openrgb-plugins/hardwaresync/default.nix diff --git a/pkgs/applications/misc/openrgb-plugins/hardwaresync/default.nix b/pkgs/applications/misc/openrgb-plugins/hardwaresync/default.nix new file mode 100644 index 000000000000..539c203325fb --- /dev/null +++ b/pkgs/applications/misc/openrgb-plugins/hardwaresync/default.nix @@ -0,0 +1,67 @@ +{ lib +, stdenv +, fetchFromGitLab +, fetchpatch +, qtbase +, openrgb +, glib +, libgtop +, lm_sensors +, qmake +, pkg-config +, wrapQtAppsHook +}: + +stdenv.mkDerivation rec { + pname = "openrgb-plugin-hardwaresync"; + version = "0.8"; + + src = fetchFromGitLab { + owner = "OpenRGBDevelopers"; + repo = "OpenRGBHardwareSyncPlugin"; + rev = "release_${version}"; + hash = "sha256-P+IitP8pQLUkBdMfcNw4fOggqyFfg6lNlnSfUGjddzo="; + }; + + patches = [ + (fetchpatch { + name = "use-pkgconfig"; + url = "https://gitlab.com/OpenRGBDevelopers/OpenRGBHardwareSyncPlugin/-/commit/df2869d679ea43119fb9b174cd0b2cb152022685.patch"; + hash = "sha256-oBtrHwpvB8Z3xYi4ucDSuw+5WijPEbgBW7vLGELFjfw="; + }) + (fetchpatch { + name = "add-install-rule"; + url = "https://gitlab.com/OpenRGBDevelopers/OpenRGBHardwareSyncPlugin/-/commit/bfbaa0a32ed05112e0cc8b6b2a8229945596e522.patch"; + hash = "sha256-76UMMzeXnyQRCEE1tGPNR5XSHTT480rQDnJ9hWhfIqY="; + }) + ]; + + 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 = [ + qtbase + glib + libgtop + lm_sensors + ]; + + nativeBuildInputs = [ + qmake + pkg-config + wrapQtAppsHook + ]; + + meta = with lib; { + homepage = "https://gitlab.com/OpenRGBDevelopers/OpenRGBHardwareSyncPlugin"; + description = "Sync your ARGB devices colors with hardware measures (CPU, GPU, fan speed, etc...)"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ff8c19b68e34..dee1e1b3b740 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10333,6 +10333,8 @@ with pkgs; openrgb = libsForQt5.callPackage ../applications/misc/openrgb { }; + openrgb-plugin-hardwaresync = libsForQt5.callPackage ../applications/misc/openrgb-plugins/hardwaresync { }; + openrussian-cli = callPackage ../misc/openrussian-cli { lua = lua5_3; }; From 9aac134336f7596d8d2f7bb1a6f141673776a5db Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 27 Jan 2023 11:33:58 +0100 Subject: [PATCH 2/4] openrgb: add withPlugins --- pkgs/applications/misc/openrgb/default.nix | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/openrgb/default.nix b/pkgs/applications/misc/openrgb/default.nix index ea81b58a2098..bd1664e85ff5 100644 --- a/pkgs/applications/misc/openrgb/default.nix +++ b/pkgs/applications/misc/openrgb/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitLab, qmake, wrapQtAppsHook, libusb1, hidapi, pkg-config, coreutils, mbedtls_2, qtbase, qttools }: +{ lib, stdenv, fetchFromGitLab, qmake, wrapQtAppsHook, libusb1, hidapi, pkg-config, coreutils, mbedtls_2, qtbase, qttools, symlinkJoin, openrgb }: stdenv.mkDerivation rec { pname = "openrgb"; @@ -25,6 +25,29 @@ stdenv.mkDerivation rec { HOME=$TMPDIR $out/bin/openrgb --help > /dev/null ''; + 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 openrgb.overrideAttrs (old: { + qmakeFlags = old.qmakeFlags or [] ++ [ + # Welcome to Escape Hell, we have backslashes + ''DEFINES+=OPENRGB_EXTRA_PLUGIN_DIRECTORY=\\\""${lib.escape ["\\" "\"" " "] (toString pluginsDir)}/lib\\\""'' + ]; + }); + meta = with lib; { description = "Open source RGB lighting control"; homepage = "https://gitlab.com/CalcProgrammer1/OpenRGB"; From 9e01b53234f2a242a51c7fb7f598121f1092cdcf Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 27 Jan 2023 11:34:22 +0100 Subject: [PATCH 3/4] openrgb-with-all-plugins: init --- pkgs/top-level/all-packages.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dee1e1b3b740..57aedd789b3d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10333,6 +10333,8 @@ with pkgs; openrgb = libsForQt5.callPackage ../applications/misc/openrgb { }; + openrgb-with-all-plugins = openrgb.withPlugins [ openrgb-plugin-hardwaresync ]; + openrgb-plugin-hardwaresync = libsForQt5.callPackage ../applications/misc/openrgb-plugins/hardwaresync { }; openrussian-cli = callPackage ../misc/openrussian-cli { From ac2d27b1c27eeed834652bed2b0cd30fbfe2e84e Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Mon, 6 Feb 2023 15:33:36 +0100 Subject: [PATCH 4/4] openrgb-plugin-effects: init at 0.8 --- .../misc/openrgb-plugins/effects/default.nix | 59 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 ++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/misc/openrgb-plugins/effects/default.nix diff --git a/pkgs/applications/misc/openrgb-plugins/effects/default.nix b/pkgs/applications/misc/openrgb-plugins/effects/default.nix new file mode 100644 index 000000000000..05cdd0ce5cc3 --- /dev/null +++ b/pkgs/applications/misc/openrgb-plugins/effects/default.nix @@ -0,0 +1,59 @@ +{ lib +, stdenv +, fetchFromGitLab +, fetchpatch +, qtbase +, openrgb +, glib +, openal +, qmake +, pkg-config +, wrapQtAppsHook +}: + +stdenv.mkDerivation rec { + pname = "openrgb-plugin-effects"; + version = "0.8"; + + src = fetchFromGitLab { + owner = "OpenRGBDevelopers"; + repo = "OpenRGBEffectsPlugin"; + rev = "release_${version}"; + hash = "sha256-2F6yeLWgR0wCwIj75+d1Vdk45osqYwRdenK21lcRoOg="; + fetchSubmodules = true; + }; + + patches = [ + # Add install rule + (fetchpatch { + url = "https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectsPlugin/-/commit/75f1b3617d9cabfb3b04a7afc75ce0c1b8514bc0.patch"; + hash = "sha256-X+zMNE3OCZNmUb68S4683r/RbE+CDrI/Jv4BMWPI47E="; + }) + ]; + + postPatch = '' + # Use the source of openrgb from nixpkgs instead of the submodule + rm -r OpenRGB + ln -s ${openrgb.src} OpenRGB + ''; + + nativeBuildInputs = [ + qmake + pkg-config + wrapQtAppsHook + ]; + + buildInputs = [ + qtbase + glib + openal + ]; + + meta = with lib; { + homepage = "https://gitlab.com/OpenRGBDevelopers/OpenRGBEffectsPlugin"; + description = "An effects plugin for OpenRGB"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 57aedd789b3d..006b2c454eb3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10333,7 +10333,12 @@ with pkgs; openrgb = libsForQt5.callPackage ../applications/misc/openrgb { }; - openrgb-with-all-plugins = openrgb.withPlugins [ openrgb-plugin-hardwaresync ]; + openrgb-with-all-plugins = openrgb.withPlugins [ + openrgb-plugin-effects + openrgb-plugin-hardwaresync + ]; + + openrgb-plugin-effects = libsForQt5.callPackage ../applications/misc/openrgb-plugins/effects { }; openrgb-plugin-hardwaresync = libsForQt5.callPackage ../applications/misc/openrgb-plugins/hardwaresync { };