summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorgnammix <71704832+gnammix@users.noreply.github.com>2024-12-29 12:13:54 +0100
committergnammix <71704832+gnammix@users.noreply.github.com>2024-12-29 12:13:54 +0100
commit62d8f5f289341497ea0fa21814e734cbea69a0a1 (patch)
tree9bb27deb391f5dccb78388e9959979f0d6cf1371 /modules/system
parent016b1608eec6c54cfaece96b63ec9d1a6cd4672b (diff)
power: move the check for restartPowerfailure support to checks.nix
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/checks.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/system/checks.nix b/modules/system/checks.nix
index 796e7e4..e6ee1b3 100644
--- a/modules/system/checks.nix
+++ b/modules/system/checks.nix
@@ -308,6 +308,15 @@ let
exit 2
fi
'';
+
+ # some mac devices, notably notebook do not support restartAfterPowerFailure option
+ restartAfterPowerFailureIsSupported = ''
+ if sudo /usr/sbin/systemsetup -getRestartPowerFailure | grep -q "Not supported"; then
+ echo "error: Your system do not support the restartAfterPowerFailure feature" >&2
+ echo "Please ensure that power.restartAfterPowerFailure is not set." >&2
+ exit 2
+ fi
+ '';
in
{
@@ -357,6 +366,7 @@ in
(mkIf cfg.verifyNixPath nixPath)
oldSshAuthorizedKeysDirectory
(mkIf config.homebrew.enable homebrewInstalled)
+ (mkIf (config.power.restartAfterPowerFailure != null) restartAfterPowerFailureIsSupported)
];
system.activationScripts.checks.text = ''