3
0
Fork 0
forked from mirrors/nixpkgs

nixos/usbStorage: add new option

This commit is contained in:
bb2020 2022-08-07 20:51:04 +03:00
parent f509e9dc87
commit ac06f213ef
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.hardware.usbStorage.manageStartStop = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
Enable this option to gracefully spin-down external storage during shutdown.
If you suspect improper head parking after poweroff, install `smartmontools` and check
for the `Power-Off_Retract_Count` field for an increment.
'';
};
config = mkIf config.hardware.usbStorage.manageStartStop {
services.udev.extraRules = ''
ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage", ATTR{manage_start_stop}="1"
'';
};
}

View file

@ -81,6 +81,7 @@
./hardware/tuxedo-keyboard.nix
./hardware/ubertooth.nix
./hardware/usb-wwan.nix
./hardware/usb-storage.nix
./hardware/onlykey/default.nix
./hardware/opentabletdriver.nix
./hardware/sata.nix