1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.thermald;
7in {
8 ###### interface
9 options = {
10 services.thermald = {
11 enable = mkEnableOption "thermald, the temperature management daemon";
12
13 debug = mkOption {
14 type = types.bool;
15 default = false;
16 description = ''
17 Whether to enable debug logging.
18 '';
19 };
20
21 configFile = mkOption {
22 type = types.nullOr types.path;
23 default = null;
24 description = "the thermald manual configuration file.";
25 };
26
27 package = mkOption {
28 type = types.package;
29 default = pkgs.thermald;
30 defaultText = "pkgs.thermald";
31 description = "Which thermald package to use.";
32 };
33 };
34 };
35
36 ###### implementation
37 config = mkIf cfg.enable {
38 services.dbus.packages = [ cfg.package ];
39
40 systemd.services.thermald = {
41 description = "Thermal Daemon Service";
42 wantedBy = [ "multi-user.target" ];
43 serviceConfig = {
44 ExecStart = ''
45 ${cfg.package}/sbin/thermald \
46 --no-daemon \
47 ${optionalString cfg.debug "--loglevel=debug"} \
48 ${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
49 --dbus-enable \
50 --adaptive
51 '';
52 };
53 };
54 };
55}