2024-04-03 13:10:46 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
2023-06-22 17:13:46 +02:00
|
|
|
|
2024-04-03 13:10:46 +02:00
|
|
|
let
|
2024-04-04 06:25:01 +02:00
|
|
|
inherit (lib) mkEnableOption mkIf;
|
2024-04-03 13:10:46 +02:00
|
|
|
inherit (pkgs) piper;
|
|
|
|
|
|
|
|
cfg = config.modules.hardware;
|
|
|
|
in
|
2023-06-22 17:13:46 +02:00
|
|
|
{
|
2024-04-03 13:10:46 +02:00
|
|
|
options.modules.hardware = {
|
2024-04-04 06:25:01 +02:00
|
|
|
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";
|
2024-04-03 13:10:46 +02:00
|
|
|
};
|
|
|
|
|
2024-04-04 06:25:01 +02:00
|
|
|
config = with cfg; {
|
|
|
|
services = {
|
|
|
|
ratbagd.enable = mkIf mouseSettings true;
|
2023-05-17 17:51:52 +02:00
|
|
|
|
2024-04-04 06:25:01 +02:00
|
|
|
udev.extraRules = mkIf disableLaptopKeyboard ''
|
|
|
|
KERNEL=="event*", ATTRS{name}=="AT Translated Set 2 keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
|
|
|
|
'';
|
2024-04-03 12:29:04 +02:00
|
|
|
|
2024-04-04 06:25:01 +02:00
|
|
|
logind = {
|
|
|
|
lidSwitch = mkIf lidIgnore "ignore";
|
|
|
|
extraConfig = mkIf powerIgnore "HandlePowerKey=ignore";
|
|
|
|
};
|
2024-04-03 13:10:46 +02:00
|
|
|
};
|
2024-04-04 06:25:01 +02:00
|
|
|
|
|
|
|
environment.systemPackages = mkIf mouseSettings [ piper ];
|
2024-04-03 13:10:46 +02:00
|
|
|
};
|
2023-05-17 17:51:52 +02:00
|
|
|
}
|