1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00
nixpkgs/nixos/modules/tasks/scsi-link-power-management.nix
Joachim Fasting 7b2b366552 nixos: set scsi link power policy using udev
Also improve option type checking by enumerating valid policy names.
2015-10-25 19:38:53 +01:00

33 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}"
'';
};
}