depot/third_party/nixpkgs/nixos/modules/services/hardware/thermald.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

59 lines
1.5 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.thermald;
in
{
###### interface
options = {
services.thermald = {
enable = mkEnableOption (lib.mdDoc "thermald, the temperature management daemon");
debug = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Whether to enable debug logging.
'';
};
ignoreCpuidCheck = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Whether to ignore the cpuid check to allow running on unsupported platforms";
};
configFile = mkOption {
type = types.nullOr types.path;
default = null;
description = lib.mdDoc "the thermald manual configuration file.";
};
package = mkPackageOption pkgs "thermald" { };
};
};
###### implementation
config = mkIf cfg.enable {
services.dbus.packages = [ cfg.package ];
systemd.services.thermald = {
description = "Thermal Daemon Service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
PrivateNetwork = true;
ExecStart = ''
${cfg.package}/sbin/thermald \
--no-daemon \
${optionalString cfg.debug "--loglevel=debug"} \
${optionalString cfg.ignoreCpuidCheck "--ignore-cpuid-check"} \
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
--dbus-enable \
--adaptive
'';
};
};
};
}