nixos/usbStorage: apply upstream
This commit is contained in:
parent
dcf2ba8faf
commit
75d77524ac
@ -1,8 +1,9 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
options.hardware.usbStorage.manageStartStop = lib.mkOption {
|
options.hardware.usbStorage.manageShutdown = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Enable this option to gracefully spin-down external storage during shutdown.
|
Enable this option to gracefully spin-down external storage during shutdown.
|
||||||
If you suspect improper head parking after poweroff, install `smartmontools` and check
|
If you suspect improper head parking after poweroff, install `smartmontools` and check
|
||||||
@ -10,9 +11,11 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.hardware.usbStorage.manageStartStop {
|
config = lib.mkIf config.hardware.usbStorage.manageShutdown {
|
||||||
services.udev.extraRules = ''
|
services.udev.extraRules = ''
|
||||||
ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage", ATTR{manage_system_start_stop}="1"
|
ACTION=="add|change", SUBSYSTEM=="scsi_disk", DRIVERS=="usb-storage|uas", ATTR{manage_shutdown}="1"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [(lib.mkRenamedOptionModule [ "hardware" "usbStorage" "manageStartStop" ] [ "hardware" "usbStorage" "manageShutdown" ])];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user