Merge pull request #44923 from Vodurden/add-thermald-config

nixos/thermald: add manual config generation
This commit is contained in:
Samuel Dionne-Riel 2018-08-19 13:37:36 -04:00 committed by GitHub
commit 730b8b1706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,16 +6,30 @@ let
cfg = config.services.thermald;
in {
###### interface
options = {
services.thermald = {
options = {
services.thermald = {
enable = mkOption {
default = false;
description = ''
Whether to enable thermald, the temperature management daemon.
'';
};
};
};
'';
};
debug = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable debug logging.
'';
};
configFile = mkOption {
type = types.nullOr types.path;
default = null;
description = "the thermald manual configuration file.";
};
};
};
###### implementation
config = mkIf cfg.enable {
@ -24,7 +38,15 @@ in {
systemd.services.thermald = {
description = "Thermal Daemon Service";
wantedBy = [ "multi-user.target" ];
script = "exec ${pkgs.thermald}/sbin/thermald --no-daemon --dbus-enable";
serviceConfig = {
ExecStart = ''
${pkgs.thermald}/sbin/thermald \
--no-daemon \
${optionalString cfg.debug "--loglevel=debug"} \
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
--dbus-enable
'';
};
};
};
}