nixos/hardware.openrazer: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-24 22:05:29 +02:00
parent ef54fd072b
commit 78026acac2

View File

@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib;
let let
cfg = config.hardware.openrazer; cfg = config.hardware.openrazer;
kernelPackages = config.boot.kernelPackages; kernelPackages = config.boot.kernelPackages;
@ -51,20 +48,20 @@ in
{ {
options = { options = {
hardware.openrazer = { hardware.openrazer = {
enable = mkEnableOption '' enable = lib.mkEnableOption ''
OpenRazer drivers and userspace daemon OpenRazer drivers and userspace daemon
''; '';
verboseLogging = mkOption { verboseLogging = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
Whether to enable verbose logging. Logs debug messages. Whether to enable verbose logging. Logs debug messages.
''; '';
}; };
syncEffectsEnabled = mkOption { syncEffectsEnabled = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
Set the sync effects flag to true so any assignment of Set the sync effects flag to true so any assignment of
@ -72,30 +69,30 @@ in
''; '';
}; };
devicesOffOnScreensaver = mkOption { devicesOffOnScreensaver = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
Turn off the devices when the systems screensaver kicks in. Turn off the devices when the systems screensaver kicks in.
''; '';
}; };
batteryNotifier = mkOption { batteryNotifier = lib.mkOption {
description = '' description = ''
Settings for device battery notifications. Settings for device battery notifications.
''; '';
default = {}; default = {};
type = types.submodule { type = lib.types.submodule {
options = { options = {
enable = mkOption { enable = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = true; default = true;
description = '' description = ''
Mouse battery notifier. Mouse battery notifier.
''; '';
}; };
frequency = mkOption { frequency = lib.mkOption {
type = types.int; type = lib.types.int;
default = 600; default = 600;
description = '' description = ''
How often battery notifications should be shown (in seconds). How often battery notifications should be shown (in seconds).
@ -103,8 +100,8 @@ in
''; '';
}; };
percentage = mkOption { percentage = lib.mkOption {
type = types.int; type = lib.types.int;
default = 33; default = 33;
description = '' description = ''
At what battery percentage the device should reach before At what battery percentage the device should reach before
@ -115,8 +112,8 @@ in
}; };
}; };
keyStatistics = mkOption { keyStatistics = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
Collects number of keypresses per hour per key used to Collects number of keypresses per hour per key used to
@ -124,8 +121,8 @@ in
''; '';
}; };
users = mkOption { users = lib.mkOption {
type = with types; listOf str; type = with lib.types; listOf str;
default = []; default = [];
description = '' description = ''
Usernames to be added to the "openrazer" group, so that they Usernames to be added to the "openrazer" group, so that they
@ -136,10 +133,10 @@ in
}; };
imports = [ imports = [
(mkRenamedOptionModule [ "hardware" "openrazer" "mouseBatteryNotifier" ] [ "hardware" "openrazer" "batteryNotifier" "enable" ]) (lib.mkRenamedOptionModule [ "hardware" "openrazer" "mouseBatteryNotifier" ] [ "hardware" "openrazer" "batteryNotifier" "enable" ])
]; ];
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot.extraModulePackages = [ kernelPackages.openrazer ]; boot.extraModulePackages = [ kernelPackages.openrazer ];
boot.kernelModules = drivers; boot.kernelModules = drivers;