From 64223a2c1b1e28dbd54068d1831a13181e585b1f Mon Sep 17 00:00:00 2001 From: Jake Woods Date: Sat, 18 Aug 2018 14:44:49 +1000 Subject: [PATCH] nixos/thermald: add manual config file thermald has two modes: zero-config and manual. Sometimes it is useful to manually configure thermald to achieve better thermal results or to give thermald a hand when detecting possible cooling options. --- nixos/modules/services/hardware/thermald.nix | 36 ++++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/hardware/thermald.nix b/nixos/modules/services/hardware/thermald.nix index 88c3f99aed4e0..69577bbe01810 100644 --- a/nixos/modules/services/hardware/thermald.nix +++ b/nixos/modules/services/hardware/thermald.nix @@ -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 + ''; + }; }; }; }