diff options
| author | Michael Hoang <Enzime@users.noreply.github.com> | 2025-01-04 13:03:10 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-04 13:03:10 +1100 |
| commit | 3feaf376d75d3d58ebf7e9a4f584d00628548ad9 (patch) | |
| tree | 1e74188bcb4f0dfb5ff36bfacdef00fe438a642b /modules/system | |
| parent | 6a1fdb2a1204c0de038847b601cff5012e162b5e (diff) | |
| parent | 492a72007ae2e7bd5895458fcd72ac2c8c9a0dc4 (diff) | |
Merge pull request #1241 from gnammix/power_conditional_setRestartPowerFailure
power: restartAfterPowerFailure option is carried out conditionally
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/checks.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/system/checks.nix b/modules/system/checks.nix index 796e7e4..91622e5 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 + printf >&2 "�[1;31merror: restarting after power failure is not supported on your machine�[0m\n" >&2 + printf >&2 "Please ensure that `power.restartAfterPowerFailure` is not set.\n" >&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 = '' |
