Merge pull request #215789 from bb2020/mbpfan
nixos/mbpfan: add aggressive option
This commit is contained in:
commit
ab8815a4b6
|
@ -1,5 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
@ -16,17 +15,19 @@ in {
|
|||
type = types.package;
|
||||
default = pkgs.mbpfan;
|
||||
defaultText = literalExpression "pkgs.mbpfan";
|
||||
description = lib.mdDoc ''
|
||||
The package used for the mbpfan daemon.
|
||||
'';
|
||||
description = lib.mdDoc "The package used for the mbpfan daemon.";
|
||||
};
|
||||
|
||||
verbose = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
If true, sets the log level to verbose.
|
||||
'';
|
||||
description = lib.mdDoc "If true, sets the log level to verbose.";
|
||||
};
|
||||
|
||||
aggressive = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc "If true, favors higher default fan speeds.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
|
@ -35,24 +36,14 @@ in {
|
|||
type = types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
|
||||
options.general.min_fan1_speed = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = 2000;
|
||||
description = lib.mdDoc ''
|
||||
You can check minimum and maximum fan limits with
|
||||
`cat /sys/devices/platform/applesmc.768/fan*_min` and
|
||||
`cat /sys/devices/platform/applesmc.768/fan*_max` respectively.
|
||||
Setting to null implies using default value from applesmc.
|
||||
'';
|
||||
};
|
||||
options.general.low_temp = mkOption {
|
||||
type = types.int;
|
||||
default = 55;
|
||||
default = 63;
|
||||
description = lib.mdDoc "If temperature is below this, fans will run at minimum speed.";
|
||||
};
|
||||
options.general.high_temp = mkOption {
|
||||
type = types.int;
|
||||
default = 58;
|
||||
default = 66;
|
||||
description = lib.mdDoc "If temperature is above this, fan speed will gradually increase.";
|
||||
};
|
||||
options.general.max_temp = mkOption {
|
||||
|
@ -79,10 +70,16 @@ in {
|
|||
];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot.kernelModules = [ "coretemp" "applesmc" ];
|
||||
services.mbpfan.settings = mkIf cfg.aggressive {
|
||||
general.min_fan1_speed = mkDefault 2000;
|
||||
general.low_temp = mkDefault 55;
|
||||
general.high_temp = mkDefault 58;
|
||||
general.max_temp = mkDefault 70;
|
||||
};
|
||||
|
||||
environment.etc."mbpfan.conf".source = settingsFile;
|
||||
boot.kernelModules = [ "coretemp" "applesmc" ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
environment.etc."mbpfan.conf".source = settingsFile;
|
||||
|
||||
systemd.services.mbpfan = {
|
||||
description = "A fan manager daemon for MacBook Pro";
|
||||
|
|
Loading…
Reference in a new issue