at 24.11-pre 639 B view raw
1{ config, lib, pkgs, ... }: 2with lib; 3 4{ 5 options.hardware.usbStorage.manageStartStop = mkOption { 6 type = types.bool; 7 default = true; 8 description = '' 9 Enable this option to gracefully spin-down external storage during shutdown. 10 If you suspect improper head parking after poweroff, install `smartmontools` and check 11 for the `Power-Off_Retract_Count` field for an increment. 12 ''; 13 }; 14 15 config = mkIf config.hardware.usbStorage.manageStartStop { 16 services.udev.extraRules = '' 17 ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage", ATTR{manage_system_start_stop}="1" 18 ''; 19 }; 20}