shell enhancements and cpu freq temp fix

This commit is contained in:
Satria 2026-02-12 22:57:39 +07:00
commit 4a06cf60dd
4 changed files with 44 additions and 16 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ pkgs, resume-dev, ... }: {
powerManagement.powertop.enable = true;
services = {
@ -6,8 +6,8 @@
#ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"
SUBSYSTEM=="power_supply", ACTION=="change", RUN+="${pkgs.writeShellScript "battery-thresholds" ''
echo 80 > /sys/class/power_supply/BAT1/charge_control_start_threshold || true
echo 85 > /sys/class/power_supply/BAT1/charge_control_end_threshold || true
echo 80 > /sys/class/power_supply/BAT*/charge_control_start_threshold || true
echo 85 > /sys/class/power_supply/BAT*/charge_control_end_threshold || true
''}"
'';
upower = {
@ -15,8 +15,8 @@
percentageCritical = 15;
percentageAction = 10;
usePercentageForPolicy = true;
allowRiskyCriticalPowerAction = true;
criticalPowerAction = "HybridSleep";
allowRiskyCriticalPowerAction = false;
criticalPowerAction = if resume-dev != "" then "Hibernate" else "PowerOff";
};
};
}

View file

@ -2,17 +2,37 @@
services = {
thermald.enable = true;
throttled.enable = true;
auto-cpufreq = {
tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_BOOST_ON_AC = "1";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_BAT = "0";
CPU_MAX_FREQ_ON_BAT = "1500000";
CPU_MIN_FREQ_ON_BAT = "400000";
START_CHARGE_THRESH_BAT0 = "80";
STOP_CHARGE_THRESH_BAT0 = "85";
START_CHARGE_THRESH_BAT1 = "80";
STOP_CHARGE_THRESH_BAT1 = "85";
};
};
auto-cpufreq = {
enable = false; # replaced with tlp until fix: https://github.com/AdnanHodzic/auto-cpufreq/issues/906
settings = {
charger = {
governor = "performance";
energy_performance_preference = "balance_performance";
energy_performance_preference = "performance";
turbo = "auto";
};
battery = {
governor = "powersave";
energy_performance_preference = "balance_power";
energy_performance_preference = "power";
turbo = "never";
};
};

View file

@ -1,4 +1,4 @@
{ hostname, flake-path, ... }: {
{ hostname, flake-path, zsh-theme, ... }: {
programs = {
pay-respects = {
enable = true;
@ -8,6 +8,14 @@
"f"
];
};
zoxide = {
enable = true;
enableZshIntegration = true;
};
fzf = {
enable = true;
enableZshIntegration = true;
};
zsh = {
enable = true;
autocd = true;
@ -24,6 +32,7 @@
"cd-gvfs" = "cd /run/user/$(id -u)/gvfs";
"wlp-set" = "swww img --transition-type=grow --transition-duration=1";
"ssh" = "TERM=xterm-256color ssh";
"cd" = "z";
"sys" = "sudo systemctl";
"sys-log" = "journalctl -f -b -u";
@ -50,16 +59,14 @@
"mkdistro-deb" = "mkdistro debian -n deb";
"wm-ctl" = "hyprctl --instance 0";
"wm-lock" = "wm-ctl dispatch exec loginctl lock-session && notify-send ${hostname} 'Manual lock triggered'";
"wm-dpms" = "wm-ctl dispatch dpms";
"wm-disp" = "wm-ctl dispatch dpms";
"git-author-setup" = "git config user.name $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user | jq -r .login) && git config user.email $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user/emails | jq -r \".[1].email\")";
"gh-author-setup" = "git config user.name $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user | jq -r .login) && git config user.email $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user/emails | jq -r \".[1].email\")";
"mcl" = "portablemc start -l $(cat .minecraft/portablemc-launch-params.json | jq -r .email) $(cat .minecraft/portablemc-launch-params.json | jq -r .version)";
"mc" = "ferium upgrade; mcl";
"please" = "SUDO_PROMPT=\"What is the magic word? \" sudo";
"pls" = "SUDO_PROMPT=\"What is the magic word? \" sudo";
};
initContent = ''
export SUDO_PROMPT="Password:"
if [[ -z "$SSH_CONNECTION" && $(tput cols) -ge 64 && $(tput lines) -ge 16 ]]; then
# ~/.fetch.sh -c 2> /dev/null
fi
@ -67,7 +74,7 @@
oh-my-zsh = {
enable = true;
plugins = ["git"];
theme = "refined";
theme = if zsh-theme != "" then zsh-theme else "random";
};
};
};