simplify framework.nix in hopes it fixes broken suspend
This commit is contained in:
parent
498b2dcce1
commit
88c207341f
1 changed files with 48 additions and 48 deletions
|
|
@ -29,22 +29,22 @@
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
# Modified TLP for power management with less aggressive settings
|
# Modified TLP for power management with less aggressive settings
|
||||||
services.tlp = {
|
# services.tlp = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
settings = {
|
# settings = {
|
||||||
CPU_BOOST_ON_BAT = 0;
|
# CPU_BOOST_ON_BAT = 0;
|
||||||
CPU_SCALING_GOVERNOR_ON_BATTERY = "powersave";
|
# CPU_SCALING_GOVERNOR_ON_BATTERY = "powersave";
|
||||||
CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
# CPU_SCALING_GOVERNOR_ON_AC = "performance";
|
||||||
CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
|
# CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
|
||||||
START_CHARGE_THRESH_BAT0 = 90;
|
# START_CHARGE_THRESH_BAT0 = 90;
|
||||||
STOP_CHARGE_THRESH_BAT0 = 97;
|
# STOP_CHARGE_THRESH_BAT0 = 97;
|
||||||
RUNTIME_PM_ON_BAT = "on"; # Less aggressive power management
|
# RUNTIME_PM_ON_BAT = "on"; # Less aggressive power management
|
||||||
HANDLE_LID_SWITCH = 1; # Suspend on lid close
|
# HANDLE_LID_SWITCH = 1; # Suspend on lid close
|
||||||
HANDLE_LID_SWITCH_DOCKED = 0; # Do nothing when docked
|
# HANDLE_LID_SWITCH_DOCKED = 0; # Do nothing when docked
|
||||||
# Disable USB autosuspend
|
# Disable USB autosuspend
|
||||||
USB_AUTOSUSPEND = 0;
|
# USB_AUTOSUSPEND = 0;
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Powersac
|
# Powersac
|
||||||
|
|
||||||
|
|
@ -65,13 +65,13 @@
|
||||||
|
|
||||||
|
|
||||||
# Disable power-profiles-daemon to resolve conflict
|
# Disable power-profiles-daemon to resolve conflict
|
||||||
services.power-profiles-daemon.enable = false;
|
# services.power-profiles-daemon.enable = false;
|
||||||
|
|
||||||
# GPU settings
|
# GPU settings
|
||||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
# services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
environment.variables = {
|
# environment.variables = {
|
||||||
DRI_PRIME = "1"; # Ensure iGPU is default
|
# DRI_PRIME = "1"; # Ensure iGPU is default
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Brightness control
|
# Brightness control
|
||||||
hardware.acpilight.enable = lib.mkDefault true;
|
hardware.acpilight.enable = lib.mkDefault true;
|
||||||
|
|
@ -80,40 +80,40 @@
|
||||||
services.fstrim.enable = lib.mkDefault true;
|
services.fstrim.enable = lib.mkDefault true;
|
||||||
|
|
||||||
# Logind lid-switch configuration
|
# Logind lid-switch configuration
|
||||||
services.logind = {
|
# services.logind = {
|
||||||
lidSwitch = "suspend";
|
# lidSwitch = "suspend";
|
||||||
lidSwitchDocked = "ignore"; # Prevent suspend when connected to a dock
|
# lidSwitchDocked = "ignore"; # Prevent suspend when connected to a dock
|
||||||
lidSwitchExternalPower = "ignore";
|
# lidSwitchExternalPower = "ignore";
|
||||||
powerKey = "poweroff"; # Optional: configure behavior for the power key
|
# powerKey = "poweroff"; # Optional: configure behavior for the power key
|
||||||
suspendKey = "suspend"; # Optional: configure behavior for the suspend key
|
# suspendKey = "suspend"; # Optional: configure behavior for the suspend key
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Suspend-then-hibernate configuration
|
# Suspend-then-hibernate configuration
|
||||||
systemd.services.suspendThenHibernate = {
|
# systemd.services.suspendThenHibernate = {
|
||||||
description = "Suspend and then hibernate";
|
# description = "Suspend and then hibernate";
|
||||||
after = [ "suspend.target" ];
|
# after = [ "suspend.target" ];
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
ExecStart = "/bin/sh -c 'sleep 3600 && systemctl hibernate'"; # Hibernate after 60 minutes
|
# ExecStart = "/bin/sh -c 'sleep 3600 && systemctl hibernate'"; # Hibernate after 60 minutes
|
||||||
Type = "oneshot";
|
# Type = "oneshot";
|
||||||
};
|
# };
|
||||||
wantedBy = [ "suspend.target" ];
|
# wantedBy = [ "suspend.target" ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Modified udev rules for runtime PM - disable problematic USB autosuspend
|
# Modified udev rules for runtime PM - disable problematic USB autosuspend
|
||||||
services.udev.extraRules = ''
|
# services.udev.extraRules = ''
|
||||||
ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"
|
# ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"
|
||||||
# ACTION=="add", SUBSYSTEM=="usb", ATTR{power/autosuspend}="10"
|
# # ACTION=="add", SUBSYSTEM=="usb", ATTR{power/autosuspend}="10"
|
||||||
'';
|
# '';
|
||||||
|
|
||||||
# ACPI lid event handler
|
# ACPI lid event handler
|
||||||
environment.etc."acpi/events/lid".source = pkgs.writeText "lid-event-handler" ''
|
# environment.etc."acpi/events/lid".source = pkgs.writeText "lid-event-handler" ''
|
||||||
event=button/lid.*
|
# event=button/lid.*
|
||||||
action=/etc/acpi/actions/lid.sh
|
# action=/etc/acpi/actions/lid.sh
|
||||||
'';
|
# '';
|
||||||
environment.etc."acpi/actions/lid.sh".source = pkgs.writeText "lid-sh-handler" ''
|
# environment.etc."acpi/actions/lid.sh".source = pkgs.writeText "lid-sh-handler" ''
|
||||||
#!/bin/bash
|
# #!/bin/bash
|
||||||
systemctl suspend
|
# systemctl suspend
|
||||||
'';
|
# '';
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
via
|
via
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue