nix-config/modules/hardware.nix

34 lines
921 B
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
2023-06-22 17:13:46 +02:00
let
inherit (lib) mkEnableOption mkIf;
inherit (pkgs) piper;
cfg = config.modules.hardware;
in
2023-06-22 17:13:46 +02:00
{
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;
2023-05-17 17:51:52 +02:00
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 ];
};
2023-05-17 17:51:52 +02:00
}