nixos/hardware: clean up "with lib;" for keyboards

This commit is contained in:
Peter Hoeg 2023-02-15 11:34:22 +08:00
parent 2a97c0d985
commit 7dc0f77ecf
3 changed files with 15 additions and 17 deletions

View File

@ -1,16 +1,16 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.hardware.keyboard.teck; cfg = config.hardware.keyboard.teck;
inherit (lib) mdDoc mkEnableOption mkIf;
in in
{ {
options.hardware.keyboard.teck = { options.hardware.keyboard.teck = {
enable = mkEnableOption (lib.mdDoc "non-root access to the firmware of TECK keyboards"); enable = mkEnableOption (mdDoc "non-root access to the firmware of TECK keyboards");
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.udev.packages = [ pkgs.teck-udev-rules ]; services.udev.packages = [ pkgs.teck-udev-rules ];
}; };
} }

View File

@ -1,12 +1,13 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.hardware.keyboard.uhk; cfg = config.hardware.keyboard.uhk;
inherit (lib) mdDoc mkEnableOption mkIf;
in in
{ {
options.hardware.keyboard.uhk = { options.hardware.keyboard.uhk = {
enable = mkEnableOption (lib.mdDoc '' enable = mkEnableOption (mdDoc ''
non-root access to the firmware of UHK keyboards. non-root access to the firmware of UHK keyboards.
You need it when you want to flash a new firmware on the keyboard. You need it when you want to flash a new firmware on the keyboard.
Access to the keyboard is granted to users in the "input" group. Access to the keyboard is granted to users in the "input" group.

View File

@ -1,21 +1,18 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) mkOption mkIf types;
cfg = config.hardware.keyboard.zsa; cfg = config.hardware.keyboard.zsa;
inherit (lib) mkEnableOption mkIf mdDoc;
in in
{ {
options.hardware.keyboard.zsa = { options.hardware.keyboard.zsa = {
enable = mkOption { enable = mkEnableOption (mdDoc ''
type = types.bool; udev rules for keyboards from ZSA like the ErgoDox EZ, Planck EZ and Moonlander Mark I.
default = false;
description = lib.mdDoc ''
Enables udev rules for keyboards from ZSA like the ErgoDox EZ, Planck EZ and Moonlander Mark I.
You need it when you want to flash a new configuration on the keyboard You need it when you want to flash a new configuration on the keyboard
or use their live training in the browser. or use their live training in the browser.
You may want to install the wally-cli package. You may want to install the wally-cli package.
''; '');
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {