blob: 018340c322f20302ed42d9200ecb2a1d490150bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.thermald;
in
{
###### interface
options = {
services.thermald = {
enable = lib.mkEnableOption "thermald, the temperature management daemon";
debug = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable debug logging.
'';
};
ignoreCpuidCheck = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to ignore the cpuid check to allow running on unsupported platforms";
};
configFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
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.
'';
};
package = lib.mkPackageOption pkgs "thermald" { };
};
};
###### implementation
config = lib.mkIf cfg.enable {
services.dbus.packages = [ cfg.package ];
systemd.services.thermald = {
description = "Thermal Daemon Service";
documentation = [ "man:thermald(8)" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
PrivateNetwork = true;
ExecStart = ''
${cfg.package}/sbin/thermald \
--no-daemon \
${lib.optionalString cfg.debug "--loglevel=debug"} \
${lib.optionalString cfg.ignoreCpuidCheck "--ignore-cpuid-check"} \
${if cfg.configFile != null then "--config-file ${cfg.configFile}" else "--adaptive"} \
--dbus-enable
'';
};
};
};
}
|