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,11 +1,12 @@
{ {
flake-path = "~/Projects/nix-conf"; # set this to the cloned repo path flake-path = "~/Projects/nix-flake"; # set this to the cloned repo path
hostname = "thinkpad"; hostname = "thinkpad";
username = "satr14"; username = "satr14";
timezone = "Asia/Jakarta"; timezone = "Asia/Jakarta";
locale = "en_US.UTF-8"; locale = "en_US.UTF-8";
zsh-theme = "refined"; # good themes: refined, re5et, risto, amuse, afowler, pmcgee, itchy, example, strug, pygmalion, muse
legacy-boot = false; # enables grub if true legacy-boot = false; # enables grub if true
enable-dm = true; # enable display manager (for server use) enable-dm = true; # enable display manager (for server use)

View file

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

View file

@ -2,17 +2,37 @@
services = { services = {
thermald.enable = true; thermald.enable = true;
throttled.enable = true; throttled.enable = true;
auto-cpufreq = { tlp = {
enable = true; 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 = { settings = {
charger = { charger = {
governor = "performance"; governor = "performance";
energy_performance_preference = "balance_performance"; energy_performance_preference = "performance";
turbo = "auto"; turbo = "auto";
}; };
battery = { battery = {
governor = "powersave"; governor = "powersave";
energy_performance_preference = "balance_power"; energy_performance_preference = "power";
turbo = "never"; turbo = "never";
}; };
}; };

View file

@ -1,4 +1,4 @@
{ hostname, flake-path, ... }: { { hostname, flake-path, zsh-theme, ... }: {
programs = { programs = {
pay-respects = { pay-respects = {
enable = true; enable = true;
@ -8,6 +8,14 @@
"f" "f"
]; ];
}; };
zoxide = {
enable = true;
enableZshIntegration = true;
};
fzf = {
enable = true;
enableZshIntegration = true;
};
zsh = { zsh = {
enable = true; enable = true;
autocd = true; autocd = true;
@ -24,6 +32,7 @@
"cd-gvfs" = "cd /run/user/$(id -u)/gvfs"; "cd-gvfs" = "cd /run/user/$(id -u)/gvfs";
"wlp-set" = "swww img --transition-type=grow --transition-duration=1"; "wlp-set" = "swww img --transition-type=grow --transition-duration=1";
"ssh" = "TERM=xterm-256color ssh"; "ssh" = "TERM=xterm-256color ssh";
"cd" = "z";
"sys" = "sudo systemctl"; "sys" = "sudo systemctl";
"sys-log" = "journalctl -f -b -u"; "sys-log" = "journalctl -f -b -u";
@ -50,16 +59,14 @@
"mkdistro-deb" = "mkdistro debian -n deb"; "mkdistro-deb" = "mkdistro debian -n deb";
"wm-ctl" = "hyprctl --instance 0"; "wm-ctl" = "hyprctl --instance 0";
"wm-lock" = "wm-ctl dispatch exec loginctl lock-session && notify-send ${hostname} 'Manual lock triggered'"; "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)"; "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"; "mc" = "ferium upgrade; mcl";
"please" = "SUDO_PROMPT=\"What is the magic word? \" sudo";
"pls" = "SUDO_PROMPT=\"What is the magic word? \" sudo";
}; };
initContent = '' initContent = ''
export SUDO_PROMPT="Password:"
if [[ -z "$SSH_CONNECTION" && $(tput cols) -ge 64 && $(tput lines) -ge 16 ]]; then if [[ -z "$SSH_CONNECTION" && $(tput cols) -ge 64 && $(tput lines) -ge 16 ]]; then
# ~/.fetch.sh -c 2> /dev/null # ~/.fetch.sh -c 2> /dev/null
fi fi
@ -67,7 +74,7 @@
oh-my-zsh = { oh-my-zsh = {
enable = true; enable = true;
plugins = ["git"]; plugins = ["git"];
theme = "refined"; theme = if zsh-theme != "" then zsh-theme else "random";
}; };
}; };
}; };