3
0
Fork 0
forked from mirrors/nixpkgs

openrgb: add withPlugins

This commit is contained in:
Francesco Gazzetta 2023-01-27 11:33:58 +01:00
parent 2e03c5e81d
commit 9aac134336

View file

@ -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";