diff --git a/lib/options.nix b/lib/options.nix index 6257167..c186f73 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -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"; username = "satr14"; timezone = "Asia/Jakarta"; 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 enable-dm = true; # enable display manager (for server use) diff --git a/modules/hardware/misc/battery-power.nix b/modules/hardware/misc/battery-power.nix index d0d69e6..bd8ee20 100644 --- a/modules/hardware/misc/battery-power.nix +++ b/modules/hardware/misc/battery-power.nix @@ -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"; }; }; } diff --git a/modules/hardware/misc/cpu-thermal.nix b/modules/hardware/misc/cpu-thermal.nix index 5cc0ef2..87f0319 100644 --- a/modules/hardware/misc/cpu-thermal.nix +++ b/modules/hardware/misc/cpu-thermal.nix @@ -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"; }; }; diff --git a/modules/home/core/zsh.nix b/modules/home/core/zsh.nix index 2ae3873..7c99bba 100644 --- a/modules/home/core/zsh.nix +++ b/modules/home/core/zsh.nix @@ -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"; }; }; };