Merge pull request #185688 from bb2020/usbstor

nixos/usbStorage: add new option

Changed files
+21
nixos
modules
+20
nixos/modules/hardware/usb-storage.nix
···
+
{ 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"
+
'';
+
};
+
}
+1
nixos/modules/module-list.nix
···
./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