2014-08-14 02:17:55 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.thermald;
|
|
|
|
in {
|
|
|
|
###### interface
|
2018-08-18 06:44:49 +02:00
|
|
|
options = {
|
|
|
|
services.thermald = {
|
2020-04-20 20:05:26 +02:00
|
|
|
enable = mkEnableOption "thermald, the temperature management daemon";
|
2018-08-18 06:44:49 +02: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-12-21 19:13:41 +01:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.thermald;
|
2021-10-03 18:06:03 +02:00
|
|
|
defaultText = literalExpression "pkgs.thermald";
|
2020-12-21 19:13:41 +01:00
|
|
|
description = "Which thermald package to use.";
|
|
|
|
};
|
2018-08-18 06:44:49 +02:00
|
|
|
};
|
|
|
|
};
|
2014-08-14 02:17:55 +02:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
2020-12-21 19:13:41 +01:00
|
|
|
services.dbus.packages = [ cfg.package ];
|
2014-11-06 14:18:56 +01:00
|
|
|
|
2014-08-14 02:17:55 +02:00
|
|
|
systemd.services.thermald = {
|
|
|
|
description = "Thermal Daemon Service";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2018-08-18 06:44:49 +02:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = ''
|
2020-12-21 19:13:41 +01:00
|
|
|
${cfg.package}/sbin/thermald \
|
2018-08-18 06:44:49 +02:00
|
|
|
--no-daemon \
|
|
|
|
${optionalString cfg.debug "--loglevel=debug"} \
|
|
|
|
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
|
2020-12-08 00:26:36 +01:00
|
|
|
--dbus-enable \
|
2020-12-03 03:02:51 +01:00
|
|
|
--adaptive
|
2018-08-18 06:44:49 +02:00
|
|
|
'';
|
|
|
|
};
|
2014-08-14 02:17:55 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|