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.
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ config, lib, pkgs, ... }:
 | 
						|
 | 
						|
with lib;
 | 
						|
 | 
						|
let
 | 
						|
  cfg = config.services.thermald;
 | 
						|
in {
 | 
						|
  ###### interface
 | 
						|
  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 {
 | 
						|
    services.dbus.packages = [ pkgs.thermald ];
 | 
						|
 | 
						|
    systemd.services.thermald = {
 | 
						|
      description = "Thermal Daemon Service";
 | 
						|
      wantedBy = [ "multi-user.target" ];
 | 
						|
      serviceConfig = {
 | 
						|
        ExecStart = ''
 | 
						|
          ${pkgs.thermald}/sbin/thermald \
 | 
						|
            --no-daemon \
 | 
						|
            ${optionalString cfg.debug "--loglevel=debug"} \
 | 
						|
            ${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \
 | 
						|
            --dbus-enable
 | 
						|
        '';
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |