power: restartAfterPowerFailure option is carried out in activation script only if supported

Minor documentation change
This commit is contained in:
gnammix 2024-12-27 21:36:31 +01:00
parent bc03f78187
commit 016b1608ee

View file

@ -15,6 +15,8 @@ in
default = null;
description = ''
Whether to restart the computer after a power failure.
Option is not supported on all devices.
'';
};
@ -33,8 +35,10 @@ in
echo "configuring power..." >&2
${lib.optionalString (cfg.restartAfterPowerFailure != null) ''
systemsetup -setRestartPowerFailure \
'${onOff cfg.restartAfterPowerFailure}' &> /dev/null
if ! systemsetup -getRestartPowerFailure | grep -q "Not supported"; then
systemsetup -setRestartPowerFailure \
'${onOff cfg.restartAfterPowerFailure}' &> /dev/null
fi
''}
${lib.optionalString (cfg.restartAfterFreeze != null) ''