add(nixos): mouse-wakeup
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
./kernel.nix
|
||||
./nix.nix
|
||||
./power.nix # TODO: this one has to be optional
|
||||
./mouse-wakeup.nix
|
||||
./programs.nix
|
||||
./security.nix
|
||||
./services.nix
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{ lib, myConfig, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = myConfig.wakeup.mouse or {};
|
||||
in
|
||||
{
|
||||
config = mkIf (cfg.disable or false && cfg.vendor != null && cfg.product != null) {
|
||||
services.udev.extraRules = ''
|
||||
# Disable wakeup for mouse configured in config.nix
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="${cfg.vendor}", ATTRS{idProduct}=="${cfg.product}", ATTR{power/wakeup}="disabled"
|
||||
'';
|
||||
};
|
||||
}
|
||||
+3
-20
@@ -1,21 +1,4 @@
|
||||
{pkgs, ...}: {
|
||||
# USB wakeup configuration
|
||||
# Disabling USB wakeups to prevent accidental wakeups from mouse/keyboard/bluetooth
|
||||
systemd.services.disable-usb-wakeups = {
|
||||
description = "Disable USB wakeup triggers";
|
||||
wantedBy = ["multi-user.target" "post-resume.target"];
|
||||
after = ["post-resume.target"];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "disable-usb-wakeups" ''
|
||||
for device in XHC0 XHC1 XHC2 XH00 GPP0 GPP7; do
|
||||
if grep -q "$device.*enabled" /proc/acpi/wakeup; then
|
||||
echo "Disabling wakeup for $device"
|
||||
echo "$device" > /proc/acpi/wakeup
|
||||
fi
|
||||
done
|
||||
'';
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
};
|
||||
{
|
||||
# This file is intentionally left blank.
|
||||
# USB wakeup is now handled by modules/nixos/mouse-wakeup.nix
|
||||
}
|
||||
Reference in New Issue
Block a user