nixos/services.openrgb: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-27 20:43:21 +02:00
parent 78b24bea0f
commit b2d74343f1

View File

@ -1,21 +1,18 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
with lib;
let let
cfg = config.services.hardware.openrgb; cfg = config.services.hardware.openrgb;
in { in {
options.services.hardware.openrgb = { options.services.hardware.openrgb = {
enable = mkEnableOption "OpenRGB server, for RGB lighting control"; enable = lib.mkEnableOption "OpenRGB server, for RGB lighting control";
package = mkPackageOption pkgs "openrgb" { }; package = lib.mkPackageOption pkgs "openrgb" { };
motherboard = mkOption { motherboard = lib.mkOption {
type = types.nullOr (types.enum [ "amd" "intel" ]); type = lib.types.nullOr (lib.types.enum [ "amd" "intel" ]);
default = if config.hardware.cpu.intel.updateMicrocode then "intel" default = if config.hardware.cpu.intel.updateMicrocode then "intel"
else if config.hardware.cpu.amd.updateMicrocode then "amd" else if config.hardware.cpu.amd.updateMicrocode then "amd"
else null; else null;
defaultText = literalMD '' defaultText = lib.literalMD ''
if config.hardware.cpu.intel.updateMicrocode then "intel" if config.hardware.cpu.intel.updateMicrocode then "intel"
else if config.hardware.cpu.amd.updateMicrocode then "amd" else if config.hardware.cpu.amd.updateMicrocode then "amd"
else null; else null;
@ -23,15 +20,15 @@ in {
description = "CPU family of motherboard. Allows for addition motherboard i2c support."; description = "CPU family of motherboard. Allows for addition motherboard i2c support.";
}; };
server.port = mkOption { server.port = lib.mkOption {
type = types.port; type = lib.types.port;
default = 6742; default = 6742;
description = "Set server port of openrgb."; description = "Set server port of openrgb.";
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ]; environment.systemPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ]; services.udev.packages = [ cfg.package ];