mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
7b2b366552
Also improve option type checking by enumerating valid policy names.
32 lines
642 B
Nix
32 lines
642 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let cfg = config.powerManagement.scsiLinkPolicy; in
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
powerManagement.scsiLinkPolicy = mkOption {
|
|
default = null;
|
|
type = types.nullOr (types.enum [ "min_power" "max_performance" "medium_power" ]);
|
|
description = ''
|
|
SCSI link power management policy. The kernel default is
|
|
"max_performance".
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf (cfg != null) {
|
|
services.udev.extraRules = ''
|
|
SUBSYSTEM=="scsi_host", ACTION=="add", KERNEL=="host*", ATTR{link_power_management_policy}="${cfg}"
|
|
'';
|
|
};
|
|
|
|
}
|