OpenRGB

Revision as of 05:43, 5 July 2024 by Mic92 (talk | contribs) (imported from old wiki)

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" ];
    };
  };
}