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.

+29 -7
+29 -7
nixos/modules/services/hardware/thermald.nix
··· 6 6 cfg = config.services.thermald; 7 7 in { 8 8 ###### interface 9 - options = { 10 - services.thermald = { 9 + options = { 10 + services.thermald = { 11 11 enable = mkOption { 12 12 default = false; 13 13 description = '' 14 14 Whether to enable thermald, the temperature management daemon. 15 - ''; 16 - }; 17 - }; 18 - }; 15 + ''; 16 + }; 17 + 18 + debug = mkOption { 19 + type = types.bool; 20 + default = false; 21 + description = '' 22 + Whether to enable debug logging. 23 + ''; 24 + }; 25 + 26 + configFile = mkOption { 27 + type = types.nullOr types.path; 28 + default = null; 29 + description = "the thermald manual configuration file."; 30 + }; 31 + }; 32 + }; 19 33 20 34 ###### implementation 21 35 config = mkIf cfg.enable { ··· 24 38 systemd.services.thermald = { 25 39 description = "Thermal Daemon Service"; 26 40 wantedBy = [ "multi-user.target" ]; 27 - script = "exec ${pkgs.thermald}/sbin/thermald --no-daemon --dbus-enable"; 41 + serviceConfig = { 42 + ExecStart = '' 43 + ${pkgs.thermald}/sbin/thermald \ 44 + --no-daemon \ 45 + ${optionalString cfg.debug "--loglevel=debug"} \ 46 + ${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \ 47 + --dbus-enable 48 + ''; 49 + }; 28 50 }; 29 51 }; 30 52 }