2014-08-14 01:17:55 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.thermald;
|
|
|
|
in {
|
|
|
|
###### interface
|
2018-08-18 05:44:49 +01:00
|
|
|
options = {
|
|
|
|
services.thermald = {
|
2020-04-20 19:05:26 +01:00
|
|
|
enable = mkEnableOption "thermald, the temperature management daemon";
|
2018-08-18 05:44:49 +01:00
|
|
|
|
|
|
|
debug = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable debug logging.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
|
|
|
description = "the thermald manual configuration file.";
|
|
|
|
};
|
2020-09-10 05:59:32 +01:00
|
|
|
|
|
|
|
adaptive = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable adaptive mode, only working on kernel versions greater than 5.8.
|
|
|
|
Thermald will detect this itself, safe to enable on kernel versions below 5.8.
|
|
|
|
'';
|
|
|
|
};
|
2018-08-18 05:44:49 +01:00
|
|
|
};
|
|
|
|
};
|
2014-08-14 01:17:55 +01:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
2014-11-06 13:18:56 +00:00
|
|
|
services.dbus.packages = [ pkgs.thermald ];
|
|
|
|
|
2014-08-14 01:17:55 +01:00
|
|
|
systemd.services.thermald = {
|
|
|
|
description = "Thermal Daemon Service";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2018-08-18 05:44:49 +01:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.thermald}/sbin/thermald \
|
|
|
|
--no-daemon \
|
|
|
|
${optionalString cfg.debug "--loglevel=debug"} \
|
|
|
|
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
|
2020-09-10 05:59:32 +01:00
|
|
|
${optionalString cfg.adaptive "--adaptive"} \
|
2018-08-18 05:44:49 +01:00
|
|
|
--dbus-enable
|
|
|
|
'';
|
|
|
|
};
|
2014-08-14 01:17:55 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|