This commit addresses two critical suspend/resume issues on the nb host: 1. Keyboard and touchpad not working after suspend - Added i2c_hid_acpi kernel module - Created systemd service to reload the module after resume - Excluded input devices from TLP USB autosuspend 2. /nix/persist becoming read-only after suspend - Moved swap from /nix/persist to dedicated @swap subvolume - Added systemd service to remount /nix/persist if needed - Separated swap from persistent data to prevent btrfs corruption Changes: - Created hosts/nb/modules/suspend-fixes.nix with resume hooks - Updated swap path from /nix/persist/swapfile to /swap/swapfile - Added /swap filesystem mount for @swap btrfs subvolume - Added USB_EXCLUDE_INPUT=1 to TLP configuration Note: Manual step required before deployment - create @swap subvolume. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.4 KiB
Nix
33 lines
1.4 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
# Add i2c_hid_acpi kernel module for proper input device support
|
|
boot.kernelModules = [ "i2c_hid_acpi" ];
|
|
|
|
# Systemd service to reload i2c_hid_acpi module after resume
|
|
# This fixes keyboard and touchpad not working after suspend
|
|
systemd.services.reload-i2c-hid-after-resume = {
|
|
description = "Reload i2c_hid_acpi module after resume to fix keyboard/touchpad";
|
|
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
|
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.kmod}/bin/rmmod i2c_hid_acpi; ${pkgs.kmod}/bin/modprobe i2c_hid_acpi'";
|
|
};
|
|
};
|
|
|
|
# Systemd service to remount /nix/persist if it becomes read-only after resume
|
|
# This fixes the btrfs read-only issue that can occur with LUKS + btrfs on suspend/resume
|
|
systemd.services.remount-persist-after-resume = {
|
|
description = "Remount /nix/persist read-write if needed after resume";
|
|
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
|
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = "${pkgs.util-linux}/bin/mount -o remount,rw /nix/persist";
|
|
# Don't fail if already mounted rw
|
|
SuccessExitStatus = [ 0 32 ];
|
|
};
|
|
};
|
|
}
|