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 = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "thermald, the temperature management daemon");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
debug = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
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;
|
|
|
|
description = lib.mdDoc "Whether to ignore the cpuid check to allow running on unsupported platforms";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "the thermald manual configuration file.";
|
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"} \
|
2020-04-24 23:36:52 +00:00
|
|
|
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
|
2020-12-09 12:39:15 +00:00
|
|
|
--dbus-enable \
|
2020-12-07 07:45:13 +00:00
|
|
|
--adaptive
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|