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