change powerSave module settings, add scripts to change power profile
All checks were successful
Build iso when a new version is pushed / test (push) Successful in 2m31s

This commit is contained in:
2025-09-17 18:58:00 +02:00
parent fbc24916b5
commit 074dff48ca
10 changed files with 155 additions and 53 deletions

View File

@ -6,7 +6,7 @@
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/09/06 00:56:57 by tomoron #+# #+# #
# Updated: 2025/09/06 01:11:42 by tomoron ### ########.fr #
# Updated: 2025/09/17 18:46:28 by tomoron ### ########.fr #
# #
# **************************************************************************** #
@ -34,7 +34,7 @@
boot.blacklistedKernelModules = [ "nvidia" "nvidia_drm" "nvidia_uvm" ]; #speeds up startup
mods.displayManager.enable = true;
mods.virtualHost.enable = false;
mods.virtualHost.enable = true;
mods.yubikey.pam.enable = true;
networking.firewall.enable = false;
@ -80,6 +80,15 @@
mods.touchpad.enable = true;
mods.powerSave.enable = true;
mods.powerSave.powahCommandAdditions = [
"supergfxctl -m Hybrid"
"if asusctl profile -p | grep Balanced ; then asusctl profile -P Performance; fi"
"if asusctl profile -p | grep Quiet ; then asusctl profile -P Balanced; fi"
];
mods.powerSave.tagueuleCommandAdditions = [
"echo \"can't safely turn off the GPU\""
"asusctl profile -P Quiet"
];
services.asusd = {
enable = true;
@ -105,6 +114,7 @@
mods.nvidia.enable = true;
mods.nvidia.prime = true;
# services.usbmuxd.enable = true; #hangs when shutting down
# boot.plymouth = {
@ -114,4 +124,6 @@
# inputs.plymouth-theme-ycontre-glow.defaultPackage.x86_64-linux
# ];
# };
services.flatpak.enable = true;
}

View File

@ -6,11 +6,11 @@
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/09/06 00:45:04 by tomoron #+# #+# #
# Updated: 2025/09/06 01:02:29 by tomoron ### ########.fr #
# Updated: 2025/09/17 18:47:27 by tomoron ### ########.fr #
# #
# **************************************************************************** #
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
{
options.mods.powerSave = {
@ -19,12 +19,66 @@
default = false;
description = "enable services and settings to save power";
};
powahCommandAdditions = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "commands the `powah` script runs";
};
tagueuleCommandAdditions = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "commands the `tagueule` script runs";
};
};
config = lib.mkIf config.mods.powerSave.enable {
services.tlp.enable = true;
services.tlp = {
enable = true;
settings = {
TLP_DEFAULT_MODE = "BAT";
TLP_PERSISTENT_DEFAULT = 1;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
};
};
environment.systemPackages = [
(pkgs.writeShellApplication {
name = "powah";
runtimeInputs = with pkgs; [ tlp ];
text = ''
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
tlp ac
'' + lib.concatStringsSep "\n" config.mods.powerSave.powahCommandAdditions;
})
(pkgs.writeShellApplication {
name = "tagueule";
runtimeInputs = with pkgs; [ tlp ];
text = ''
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
tlp bat
'' + lib.concatStringsSep "\n" config.mods.powerSave.tagueuleCommandAdditions;
})
];
powerManagement.enable = true;
powerManagement.cpuFreqGovernor = "powersave";
services.upower.enable = true;
mods.nvidia.prime = true;
};