nixpkgs/nixos/modules/services/hardware/openrgb.nix
stuebinm 6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00

56 lines
1.6 KiB
Nix

{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.hardware.openrgb;
in {
options.services.hardware.openrgb = {
enable = mkEnableOption "OpenRGB server, for RGB lighting control";
package = mkPackageOption pkgs "openrgb" { };
motherboard = mkOption {
type = types.nullOr (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 = 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 = mkOption {
type = types.port;
default = 6742;
description = "Set server port of openrgb.";
};
};
config = 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";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
StateDirectory = "OpenRGB";
WorkingDirectory = "/var/lib/OpenRGB";
ExecStart = "${cfg.package}/bin/openrgb --server --server-port ${toString cfg.server.port}";
Restart = "always";
};
};
};
meta.maintainers = with lib.maintainers; [ jonringer ];
}