nix/module/powersave/default.nix

20 lines
593 B
Nix
Raw Normal View History

# Disable CPU boost after boot. Control with `powersave` script.
{ lib, pkgs, controlFile, enable, disable, ... }: {
systemd = {
services.powersave = {
description = "Disable CPU Boost";
enable = true;
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";
ExecStart = "${lib.getExe pkgs.bash} -c 'echo ${enable} > ${controlFile}'";
ExecStop = "${lib.getExe pkgs.bash} -c 'echo ${disable} > ${controlFile}'";
};
};
2024-05-06 22:30:55 +03:00
# HACK: Allow user access.
tmpfiles.rules = [ "z ${controlFile} 0777 - - - -" ];
};
}