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
All checks were successful
Build iso when a new version is pushed / test (push) Successful in 2m31s
This commit is contained in:
@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user