From 016b1608eec6c54cfaece96b63ec9d1a6cd4672b Mon Sep 17 00:00:00 2001 From: gnammix <71704832+gnammix@users.noreply.github.com> Date: Fri, 27 Dec 2024 21:36:31 +0100 Subject: [PATCH] power: restartAfterPowerFailure option is carried out in activation script only if supported Minor documentation change --- modules/power/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/power/default.nix b/modules/power/default.nix index a99905f..e36a027 100644 --- a/modules/power/default.nix +++ b/modules/power/default.nix @@ -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) ''