nix-config/modules/hardware.nix
Donovan Glover a18125eaf9
meta: Use mkIf for hardware-specific config
Should make it easier to use this config without pulling in
the hardware-specific stuff.
2024-04-04 00:25:08 -04:00

34 lines
921 B
Nix

{ pkgs, config, lib, ... }:
let
inherit (lib) mkEnableOption mkIf;
inherit (pkgs) piper;
cfg = config.modules.hardware;
in
{
options.modules.hardware = {
mouseSettings = mkEnableOption "piper for gaming mice";
disableLaptopKeyboard = mkEnableOption "udev rule to disable laptop keyboard";
lidIgnore = mkEnableOption "ignoring the laptop lid on close";
powerIgnore = mkEnableOption "ignoring the power button on press";
};
config = with cfg; {
services = {
ratbagd.enable = mkIf mouseSettings true;
udev.extraRules = mkIf disableLaptopKeyboard ''
KERNEL=="event*", ATTRS{name}=="AT Translated Set 2 keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
'';
logind = {
lidSwitch = mkIf lidIgnore "ignore";
extraConfig = mkIf powerIgnore "HandlePowerKey=ignore";
};
};
environment.systemPackages = mkIf mouseSettings [ piper ];
};
}