diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 533b0aee..eef1a125 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -2259,6 +2259,16 @@ in
A new module is available: 'programs.less'.
'';
}
+
+ {
+ time = "2021-11-29T15:15:59+00:00";
+ condition = hostPlatform.isDarwin;
+ message = ''
+ The option 'targets.darwin.defaults."com.apple.menuextra.battery".ShowPercent'
+ has been deprecated since it no longer works on the latest version of
+ macOS.
+ '';
+ }
];
};
}
diff --git a/modules/targets/darwin/default.nix b/modules/targets/darwin/default.nix
index d2764bd1..9fd9dac0 100644
--- a/modules/targets/darwin/default.nix
+++ b/modules/targets/darwin/default.nix
@@ -48,6 +48,24 @@ in {
platforms.darwin)
];
+ warnings = let
+ batteryPercentage =
+ attrByPath [ "com.apple.menuextra.battery" "ShowPercent" ] null
+ cfg.defaults;
+ webkitDevExtras = attrByPath [
+ "com.apple.Safari"
+ "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled"
+ ] null cfg.defaults;
+ in optional (batteryPercentage != null) ''
+ The option 'com.apple.menuextra.battery.ShowPercent' no longer works on
+ macOS 11 and later. Instead, open System Preferences, go to "Dock &
+ Menu Bar", select "Battery", and toggle the checkbox labeled "Show
+ Percentage."
+ '' ++ optional (webkitDevExtras != null) ''
+ The option 'com.apple.Safari.com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled'
+ is no longer present in recent versions of Safari.
+ '';
+
home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] ''
$VERBOSE_ECHO "Configuring macOS user defaults"
${concatStringsSep "\n" activationCmds}
diff --git a/modules/targets/darwin/options.nix b/modules/targets/darwin/options.nix
index f722fbfa..65ce4e01 100644
--- a/modules/targets/darwin/options.nix
+++ b/modules/targets/darwin/options.nix
@@ -98,7 +98,13 @@ in {
"com.apple.menuextra.battery".ShowPercent = mkNullableOption {
type = types.enum [ "YES" "NO" ];
example = "NO";
- description = "Whether to show battery percentage in the menu bar.";
+ description = ''
+ This option no longer works on macOS 11 and later. Instead, open System
+ Preferences, go to "Dock & Menu Bar", select "Battery", and toggle
+ the checkbox labeled "Show Percentage."
+
+ Whether to show battery percentage in the menu bar.
+ '';
};
"com.apple.Safari" = {
@@ -125,20 +131,35 @@ in {
'';
};
- "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
- mkNullableOption {
- type = types.bool;
- description = ''
- Configures the web inspector.
+ "WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
+ type = types.bool;
+ description = ''
+ Configures the web inspector.
-
-
- Instead of setting this option directly, set
- instead.
-
-
- '';
- };
+
+
+ Instead of setting this option directly, set
+ instead.
+
+
+ '';
+ };
+ };
+
+ "com.apple.Safari.SandboxBroker" = {
+ ShowDevelopMenu = mkNullableOption {
+ type = types.bool;
+ description = ''
+ Show the "Develop" menu in Safari's menubar.
+
+
+
+ Instead of setting this option directly, set
+ instead.
+
+
+ '';
+ };
};
"com.googlecode.iterm2" = {
@@ -182,8 +203,11 @@ in {
config = {
"com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) {
WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu;
- "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
- safari.IncludeDevelopMenu;
+ "WebKitPreferences.developerExtrasEnabled" = safari.IncludeDevelopMenu;
};
+ "com.apple.Safari.SandboxBroker" =
+ mkIf (safari.IncludeDevelopMenu != null) {
+ ShowDevelopMenu = safari.IncludeDevelopMenu;
+ };
};
}