nix/module/powersave/default.nix

19 lines
528 B
Nix
Raw Normal View History

{ 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 - - - -" ];
};
}