blob: 8cc34e78fdd401c590713bdc3b79d1ab42e70aa3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
{
config,
lib,
pkgs,
...
}:
{
options.hardware.usbStorage.manageShutdown = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
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 = lib.mkIf config.hardware.usbStorage.manageShutdown {
services.udev.extraRules = ''
ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage|uas", ATTR{manage_shutdown}="1"
'';
};
imports = [
(lib.mkRenamedOptionModule
[ "hardware" "usbStorage" "manageStartStop" ]
[ "hardware" "usbStorage" "manageShutdown" ]
)
];
}
|