1 { config, lib, pkgs, ... }:
4 options.hardware.usbStorage.manageShutdown = lib.mkOption {
8 Enable this option to gracefully spin-down external storage during shutdown.
9 If you suspect improper head parking after poweroff, install `smartmontools` and check
10 for the `Power-Off_Retract_Count` field for an increment.
14 config = lib.mkIf config.hardware.usbStorage.manageShutdown {
15 services.udev.extraRules = ''
16 ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage|uas", ATTR{manage_shutdown}="1"
20 imports = [(lib.mkRenamedOptionModule [ "hardware" "usbStorage" "manageStartStop" ] [ "hardware" "usbStorage" "manageShutdown" ])];