powertop attempt to load some kernel modules like msr by calling modprobe. This is the counterpart to 88e43eb39bcda5f8fdf41d566bc6799596177cd0 which has the powertop executable search PATH for modprobe rather than hardcoding /sbin, and actually adds the directory containing modprobe to its PATH for the systemd service.
		
			
				
	
	
		
			29 lines
		
	
	
		
			611 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			611 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ config, lib, pkgs, ... }:
 | 
						|
 | 
						|
with lib;
 | 
						|
 | 
						|
let
 | 
						|
  cfg = config.powerManagement.powertop;
 | 
						|
in {
 | 
						|
  ###### interface
 | 
						|
 | 
						|
  options.powerManagement.powertop.enable = mkEnableOption "powertop auto tuning on startup";
 | 
						|
 | 
						|
  ###### implementation
 | 
						|
 | 
						|
  config = mkIf (cfg.enable) {
 | 
						|
    systemd.services = {
 | 
						|
      powertop = {
 | 
						|
        wantedBy = [ "multi-user.target" ];
 | 
						|
        description = "Powertop tunings";
 | 
						|
        path = [ pkgs.kmod ];
 | 
						|
        serviceConfig = {
 | 
						|
          Type = "oneshot";
 | 
						|
          RemainAfterExit = "yes";
 | 
						|
          ExecStart = "${pkgs.powertop}/bin/powertop --auto-tune";
 | 
						|
        };
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |