1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let cfg = config.powerManagement.scsiLinkPolicy; in
6
7{
8 ###### interface
9
10 options = {
11
12 powerManagement.scsiLinkPolicy = mkOption {
13 default = null;
14 type = types.nullOr (types.enum [ "min_power" "max_performance" "medium_power" ]);
15 description = ''
16 SCSI link power management policy. The kernel default is
17 "max_performance".
18 '';
19 };
20
21 };
22
23
24 ###### implementation
25
26 config = mkIf (cfg != null) {
27 services.udev.extraRules = ''
28 SUBSYSTEM=="scsi_host", ACTION=="add", KERNEL=="host*", ATTR{link_power_management_policy}="${cfg}"
29 '';
30 };
31
32}