at 25.11-pre 803 B view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8{ 9 options.hardware.usbStorage.manageShutdown = lib.mkOption { 10 type = lib.types.bool; 11 default = false; 12 description = '' 13 Enable this option to gracefully spin-down external storage during shutdown. 14 If you suspect improper head parking after poweroff, install `smartmontools` and check 15 for the `Power-Off_Retract_Count` field for an increment. 16 ''; 17 }; 18 19 config = lib.mkIf config.hardware.usbStorage.manageShutdown { 20 services.udev.extraRules = '' 21 ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage|uas", ATTR{manage_shutdown}="1" 22 ''; 23 }; 24 25 imports = [ 26 (lib.mkRenamedOptionModule 27 [ "hardware" "usbStorage" "manageStartStop" ] 28 [ "hardware" "usbStorage" "manageShutdown" ] 29 ) 30 ]; 31}