fix: hibernate resume for nb
This commit is contained in:
@@ -72,6 +72,14 @@ in {
|
|||||||
theme = "steeef"; # Set theme
|
theme = "steeef"; # Set theme
|
||||||
plugins = [ "git" ]; # Add plugins
|
plugins = [ "git" ]; # Add plugins
|
||||||
};
|
};
|
||||||
|
interactiveShellInit = ''
|
||||||
|
# Bind Shift+Return to insert newline (foot terminal sends \e[27;2;13~)
|
||||||
|
insert-newline() {
|
||||||
|
LBUFFER="''${LBUFFER}"$'\n'
|
||||||
|
}
|
||||||
|
zle -N insert-newline
|
||||||
|
bindkey '^[[27;2;13~' insert-newline
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
users.defaultUserShell = pkgs.zsh;
|
users.defaultUserShell = pkgs.zsh;
|
||||||
|
|
||||||
@@ -93,8 +101,8 @@ in {
|
|||||||
# Battery optimization - increase dirty writeback time to batch writes
|
# Battery optimization - increase dirty writeback time to batch writes
|
||||||
"vm.dirty_writeback_centisecs" = 3000; # 30 seconds (default: 500 = 5s)
|
"vm.dirty_writeback_centisecs" = 3000; # 30 seconds (default: 500 = 5s)
|
||||||
"vm.dirty_expire_centisecs" = 3000; # 30 seconds (default: 3000)
|
"vm.dirty_expire_centisecs" = 3000; # 30 seconds (default: 3000)
|
||||||
# Enable laptop mode for aggressive disk power management
|
# Enable laptop mode for disk power management (2 = balanced, less aggressive than 5)
|
||||||
"vm.laptop_mode" = 5;
|
"vm.laptop_mode" = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
# nixos cross building qemu
|
# nixos cross building qemu
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
"snd_hda_intel.power_save=1"
|
"snd_hda_intel.power_save=1"
|
||||||
"transparent_hugepage=madvise"
|
"transparent_hugepage=madvise"
|
||||||
"pcie_aspm=force"
|
"pcie_aspm=force"
|
||||||
"nvme.noacpi=1"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
|
|||||||
@@ -4,29 +4,21 @@
|
|||||||
# Add i2c_hid_acpi kernel module for proper input device support
|
# Add i2c_hid_acpi kernel module for proper input device support
|
||||||
boot.kernelModules = [ "i2c_hid_acpi" ];
|
boot.kernelModules = [ "i2c_hid_acpi" ];
|
||||||
|
|
||||||
# Systemd service to reload i2c_hid_acpi module after resume
|
# Commands to run after resume from suspend/hibernate
|
||||||
# This fixes keyboard and touchpad not working after suspend
|
# This is the NixOS-native way to ensure proper execution timing
|
||||||
systemd.services.reload-i2c-hid-after-resume = {
|
powerManagement.resumeCommands = ''
|
||||||
description = "Reload i2c_hid_acpi module after resume to fix keyboard/touchpad";
|
# Reload i2c_hid_acpi module to fix keyboard/touchpad after suspend
|
||||||
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
${pkgs.kmod}/bin/rmmod i2c_hid_acpi || true
|
||||||
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
${pkgs.kmod}/bin/modprobe i2c_hid_acpi
|
||||||
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
|
# Sync filesystem to ensure all pending writes are committed
|
||||||
# This fixes the btrfs read-only issue that can occur with LUKS + btrfs on suspend/resume
|
${pkgs.util-linux}/bin/sync
|
||||||
systemd.services.remount-persist-after-resume = {
|
|
||||||
description = "Remount /nix/persist read-write if needed after resume";
|
# Remount all btrfs subvolumes read-write if they became read-only
|
||||||
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
# This fixes the issue where LUKS + btrfs can remount read-only after suspend
|
||||||
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
${pkgs.util-linux}/bin/mount -o remount,rw /nix || true
|
||||||
serviceConfig = {
|
${pkgs.util-linux}/bin/mount -o remount,rw /nix/store || true
|
||||||
Type = "oneshot";
|
${pkgs.util-linux}/bin/mount -o remount,rw /nix/persist || true
|
||||||
ExecStart = "${pkgs.util-linux}/bin/mount -o remount,rw /nix/persist";
|
${pkgs.util-linux}/bin/mount -o remount,rw /swap || true
|
||||||
# Don't fail if already mounted rw
|
'';
|
||||||
SuccessExitStatus = [ 0 32 ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user