firefox: assert bookmarks migration warning

This commit is contained in:
Austin Horstman
2026-06-01 12:43:59 -05:00
parent 6a6941ad20
commit 6459fc4aee
6 changed files with 186 additions and 20 deletions

View File

@@ -483,25 +483,11 @@ in
(
bookmarks:
if bookmarks != { } then
lib.warn
''
${cfg.name} bookmarks have been refactored into a submodule that now explicitly require a 'force' option to be enabled.
Replace:
${moduleName}.profiles.${name}.bookmarks = [ ... ];
With:
${moduleName}.profiles.${name}.bookmarks = {
force = true;
settings = [ ... ];
};
''
{
force = true;
settings = bookmarks;
}
{
force = true;
_legacySettings = if builtins.isList bookmarks then "a list" else "an attribute set";
settings = bookmarks;
}
else
{ }
)
@@ -1028,7 +1014,59 @@ in
++ optional (cfg.vendorPath != null) ''
Using '${moduleName}.vendorPath' has been deprecated and
will be removed in the future. Native messaging hosts will function normally without specifying this path.
'';
''
++ lib.flatten (
lib.mapAttrsToList (
name: profile:
lib.optional (profile.bookmarks._legacySettings != null) (
let
legacySettingsExample =
if profile.bookmarks._legacySettings == "a list" then "[ ... ]" else "{ ... }";
in
lib.hm.deprecations.mkDeprecatedOptionValueWarning {
option = modulePath ++ [
"profiles"
name
"bookmarks"
];
old = profile.bookmarks._legacySettings;
replacement = "`${
lib.showOption (
modulePath
++ [
"profiles"
name
"bookmarks"
"settings"
]
)
}` with `${
lib.showOption (
modulePath
++ [
"profiles"
name
"bookmarks"
"force"
]
)
} = true`";
details = ''
Set `force = true` to acknowledge replacing existing custom bookmarks.
Replace:
${moduleName}.profiles.${name}.bookmarks = ${legacySettingsExample};
With:
${moduleName}.profiles.${name}.bookmarks = {
force = true;
settings = ${legacySettingsExample};
};
'';
}
)
) cfg.profiles
);
targets.darwin.defaults = (
mkIf (cfg.darwinDefaultsId != null && isDarwin) {

View File

@@ -84,6 +84,12 @@ in
];
options = {
_legacySettings = mkOption {
type = types.nullOr types.str;
default = null;
visible = false;
};
enable = mkOption {
type = with types; bool;
default = config.settings != [ ];