2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.thermald;
|
2022-01-19 23:45:15 +00:00
|
|
|
in
|
|
|
|
{
|
2020-04-24 23:36:52 +00:00
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.thermald = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "thermald, the temperature management daemon";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
debug = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Whether to enable debug logging.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
ignoreCpuidCheck = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Whether to ignore the cpuid check to allow running on unsupported platforms";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2024-06-05 15:53:02 +00:00
|
|
|
description = ''
|
|
|
|
The thermald manual configuration file.
|
|
|
|
|
|
|
|
Leave unspecified to run with the `--adaptive` flag instead which will have thermald use your computer's DPTF adaptive tables.
|
|
|
|
|
|
|
|
See `man thermald` for more information.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "thermald" { };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
2020-12-25 13:55:36 +00:00
|
|
|
services.dbus.packages = [ cfg.package ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
systemd.services.thermald = {
|
|
|
|
description = "Thermal Daemon Service";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2022-01-19 23:45:15 +00:00
|
|
|
PrivateNetwork = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
ExecStart = ''
|
2020-12-25 13:55:36 +00:00
|
|
|
${cfg.package}/sbin/thermald \
|
2020-04-24 23:36:52 +00:00
|
|
|
--no-daemon \
|
|
|
|
${optionalString cfg.debug "--loglevel=debug"} \
|
2024-01-02 11:29:13 +00:00
|
|
|
${optionalString cfg.ignoreCpuidCheck "--ignore-cpuid-check"} \
|
2024-06-05 15:53:02 +00:00
|
|
|
${if cfg.configFile != null then "--config-file ${cfg.configFile}" else "--adaptive"} \
|
2024-05-15 15:35:15 +00:00
|
|
|
--dbus-enable
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|