Files
nixos/hosts/nb/hardware-configuration.nix
Dominik Polakovics 28ed3fcf74 fix(nb): resolve keyboard/touchpad and btrfs read-only issues after suspend
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>
2025-10-19 16:43:02 +02:00

131 lines
3.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.loader.systemd-boot = {
enable = true;
configurationLimit = 5;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.availableKernelModules = [ "vfat" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ "kvm-amd" ];
boot.kernelModules = [ "amdgpu" ];
boot.extraModulePackages = [ ];
# AMD Ryzen 7 7840U optimizations
boot.kernelParams = [
"amd_pstate=active"
"amd_pstate.shared_mem=1"
"amdgpu.dcdebugmask=0x10"
"amdgpu.dc=1"
"amdgpu.ppfeaturemask=0xffffffff"
"amdgpu.gpu_recovery=1"
"snd_hda_intel.power_save=1"
"transparent_hugepage=madvise"
"pcie_aspm=force"
"nvme.noacpi=1"
];
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [ "size=16G" "mode=755" ];
};
boot.initrd = {
luks.devices."root" = {
crypttabExtraOpts = [ "fido2-device=auto" ];
device = "/dev/disk/by-label/root";
};
systemd.enable = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
fileSystems."/nix" = {
device = "/dev/mapper/root";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@"
"ssd"
"compress=zstd:1"
"discard=async"
"noatime"
"commit=120"
];
};
fileSystems."/nix/store" = {
device = "/dev/mapper/root";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@nix-store"
"ssd"
"compress=zstd:1"
"discard=async"
"noatime"
"commit=120"
];
};
fileSystems."/nix/persist" = {
device = "/dev/mapper/root";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@nix-persist"
"ssd"
"compress=zstd:1"
"discard=async"
"noatime"
"commit=120"
];
};
fileSystems."/swap" = {
device = "/dev/mapper/root";
fsType = "btrfs";
neededForBoot = true;
options = [
"subvol=@swap"
"noatime"
];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp52s0.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
vaapiVdpau
libvdpau-va-gl
libva
libva-utils
];
};
# Optimal I/O scheduler for NVMe SSDs
services.udev.extraRules = ''
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none"
'';
}