2014-04-14 07:26:48 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-01-11 23:54:09 -08:00
|
|
|
|
2014-04-14 07:26:48 -07:00
|
|
|
with lib;
|
2012-01-11 23:54:09 -08:00
|
|
|
|
2015-10-25 10:58:48 -07:00
|
|
|
let cfg = config.powerManagement.scsiLinkPolicy; in
|
|
|
|
|
2012-01-11 23:54:09 -08:00
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2012-10-04 20:25:11 -07:00
|
|
|
|
2012-01-11 23:54:09 -08:00
|
|
|
powerManagement.scsiLinkPolicy = mkOption {
|
2015-10-25 10:58:48 -07:00
|
|
|
default = null;
|
|
|
|
type = types.nullOr (types.enum [ "min_power" "max_performance" "medium_power" ]);
|
2012-01-11 23:54:09 -08:00
|
|
|
description = ''
|
2015-10-25 10:58:48 -07:00
|
|
|
SCSI link power management policy. The kernel default is
|
|
|
|
"max_performance".
|
2012-01-11 23:54:09 -08:00
|
|
|
'';
|
|
|
|
};
|
2012-10-04 20:25:11 -07:00
|
|
|
|
2012-01-11 23:54:09 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2015-10-25 10:58:48 -07:00
|
|
|
config = mkIf (cfg != null) {
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
SUBSYSTEM=="scsi_host", ACTION=="add", KERNEL=="host*", ATTR{link_power_management_policy}="${cfg}"
|
|
|
|
'';
|
2012-01-11 23:54:09 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|