2012-01-12 08:54:09 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
powerManagement.scsiLinkPolicy = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "min_power";
|
2012-01-13 14:26:52 +01:00
|
|
|
type = types.uniq types.string;
|
2012-01-12 08:54:09 +01:00
|
|
|
description = ''
|
|
|
|
Configure the scsi link power management policy. By default,
|
|
|
|
the kernel configures "max_performance".
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf (config.powerManagement.scsiLinkPolicy != "") {
|
|
|
|
|
2012-01-13 09:46:32 +01:00
|
|
|
jobs.scsilinkpmpolicy =
|
2012-01-12 08:54:09 +01:00
|
|
|
{ description = "Set SCSI link power management policy";
|
|
|
|
|
|
|
|
startOn = "started udev";
|
|
|
|
|
|
|
|
task = true;
|
|
|
|
|
|
|
|
script = ''
|
|
|
|
for x in /sys/class/scsi_host/host*/link_power_management_policy; do
|
|
|
|
echo ${config.powerManagement.scsiLinkPolicy} > $x
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|