OpenRGB: Difference between revisions

From NixOS Wiki
imported>SIGSTKFLT
add install instructions
imported from old wiki
Line 6: Line 6:
</syntaxhighlight>
</syntaxhighlight>
No need to add OpenRGB to systemPackages.
No need to add OpenRGB to systemPackages.
Please do note that installing this package by itself will lead to <code>udev</code> rules not being set up correctly. It is recommended to have both <code>services.hardware.openrgb.enable = true;</code> and the package installed.
== Plugins ==
Currently there is no functioning option to install individual plugins, but there is a way to install all of them.
Add this systemPackage to <code>/etc/nixos/configuration.nix</code>:
<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs; [ openrgb-with-all-plugins ];
</syntaxhighlight>
{{warning|1=Please do note that installing this package by itself will lead to <code>udev</code> rules not being set up correctly. It is recommended to have both <code>services.hardware.openrgb.enable = true;</code> and the package installed.}}


== Turn off RGB ==
== Turn off RGB ==

Revision as of 05:43, 5 July 2024

Installation

add to /etc/nixos/configuration.nix:

services.hardware.openrgb.enable = true;

No need to add OpenRGB to systemPackages.

Please do note that installing this package by itself will lead to udev rules not being set up correctly. It is recommended to have both services.hardware.openrgb.enable = true; and the package installed.

Plugins

Currently there is no functioning option to install individual plugins, but there is a way to install all of them.

Add this systemPackage to /etc/nixos/configuration.nix:

environment.systemPackages = with pkgs; [ openrgb-with-all-plugins ];
Warning: Please do note that installing this package by itself will lead to udev rules not being set up correctly. It is recommended to have both services.hardware.openrgb.enable = true; and the package installed.

Turn off RGB

If you'd like to turn off all RGB devices supported by OpenRGB, consider something like:

{ pkgs, lib, ... }:
let
  no-rgb = pkgs.writeScriptBin "no-rgb" ''
    #!/bin/sh
    NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | grep -E '^[0-9]+: ' | wc -l)

    for i in $(seq 0 $(($NUM_DEVICES - 1))); do
      ${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode static --color 000000
    done
  '';
in {
  config = {
    services.udev.packages = [ pkgs.openrgb ];
    boot.kernelModules = [ "i2c-dev" ];
    hardware.i2c.enable = true;

    systemd.services.no-rgb = {
      description = "no-rgb";
      serviceConfig = {
        ExecStart = "${no-rgb}/bin/no-rgb";
        Type = "oneshot";
      };
      wantedBy = [ "multi-user.target" ];
    };
  };
}