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