Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

79 lines
2.1 KiB
Nix

{
pkgs,
lib,
config,
...
}:
let
cfg = config.services.hardware.openrgb;
in
{
options.services.hardware.openrgb = {
enable = lib.mkEnableOption "OpenRGB server, for RGB lighting control";
package = lib.mkPackageOption pkgs "openrgb" { };
motherboard = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"amd"
"intel"
]
);
default =
if config.hardware.cpu.intel.updateMicrocode then
"intel"
else if config.hardware.cpu.amd.updateMicrocode then
"amd"
else
null;
defaultText = lib.literalMD ''
if config.hardware.cpu.intel.updateMicrocode then "intel"
else if config.hardware.cpu.amd.updateMicrocode then "amd"
else null;
'';
description = "CPU family of motherboard. Allows for addition motherboard i2c support.";
};
server.port = lib.mkOption {
type = lib.types.port;
default = 6742;
description = "Set server port of openrgb.";
};
startupProfile = lib.mkOption {
type = lib.types.nullOr (lib.types.str);
default = null;
description = "The profile file to load from \"/var/lib/OpenRGB\" at startup.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
boot.kernelModules = [
"i2c-dev"
]
++ lib.optionals (cfg.motherboard == "amd") [ "i2c-piix4" ]
++ lib.optionals (cfg.motherboard == "intel") [ "i2c-i801" ];
systemd.services.openrgb = {
description = "OpenRGB server daemon";
after = [ "network.target" ];
wants = [ "dev-usb.device" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
StateDirectory = "OpenRGB";
WorkingDirectory = "/var/lib/OpenRGB";
ExecStart =
"${cfg.package}/bin/openrgb --server --server-port ${toString cfg.server.port}"
+ lib.optionalString (builtins.isString cfg.startupProfile) " --profile ${lib.escapeShellArg cfg.startupProfile}";
Restart = "always";
};
};
};
meta.maintainers = [ ];
}