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

@@ -0,0 +1,50 @@
{
config,
...
}:
let
cfg = config.programs.firefox;
in
{
imports = [
(import ./setup-firefox-mock-overlay.nix [
"programs"
"firefox"
])
];
home.stateVersion = "26.05";
programs.firefox = {
enable = true;
profiles.default.bookmarks = {
"Home Manager" = {
url = "https://wiki.nixos.org/wiki/Home_Manager";
};
};
};
test.asserts.warnings.expected = [
''
Using `programs.firefox.profiles.default.bookmarks` as an attribute set is deprecated and will be
removed in a future release. Please use `programs.firefox.profiles.default.bookmarks.settings` with `programs.firefox.profiles.default.bookmarks.force = true` instead.
Set `force = true` to acknowledge replacing existing custom bookmarks.
Replace:
programs.firefox.profiles.default.bookmarks = { ... };
With:
programs.firefox.profiles.default.bookmarks = {
force = true;
settings = { ... };
};
''
];
nmt.script = ''
assertFileExists "home-files/${cfg.profilesPath}/default/user.js"
'';
}

View File

@@ -0,0 +1,51 @@
{
config,
...
}:
let
cfg = config.programs.firefox;
in
{
imports = [
(import ./setup-firefox-mock-overlay.nix [
"programs"
"firefox"
])
];
home.stateVersion = "26.05";
programs.firefox = {
enable = true;
profiles.default.bookmarks = [
{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}
];
};
test.asserts.warnings.expected = [
''
Using `programs.firefox.profiles.default.bookmarks` as a list is deprecated and will be
removed in a future release. Please use `programs.firefox.profiles.default.bookmarks.settings` with `programs.firefox.profiles.default.bookmarks.force = true` instead.
Set `force = true` to acknowledge replacing existing custom bookmarks.
Replace:
programs.firefox.profiles.default.bookmarks = [ ... ];
With:
programs.firefox.profiles.default.bookmarks = {
force = true;
settings = [ ... ];
};
''
];
nmt.script = ''
assertFileExists "home-files/${cfg.profilesPath}/default/user.js"
'';
}

View File

@@ -1,5 +1,7 @@
{ lib, ... }:
{
"firefox-bookmarks-legacy-warning" = ./bookmarks-legacy-warning.nix;
"firefox-bookmarks-legacy-attrset-warning" = ./bookmarks-legacy-attrset-warning.nix;
"firefox-config-path-explicit-legacy" = ./config-path-explicit-legacy.nix;
"firefox-config-path-explicit-xdg" = ./config-path-explicit-xdg.nix;
"firefox-config-path-xdg-default" = ./config-path-xdg-default.nix;

View File

@@ -72,6 +72,25 @@ in
};
}
// {
test.asserts.warnings.expected = [
''
Using `${lib.showOption modulePath}.profiles.bookmarks.bookmarks` as an attribute set is deprecated and will be
removed in a future release. Please use `${lib.showOption modulePath}.profiles.bookmarks.bookmarks.settings` with `${lib.showOption modulePath}.profiles.bookmarks.bookmarks.force = true` instead.
Set `force = true` to acknowledge replacing existing custom bookmarks.
Replace:
${lib.showOption modulePath}.profiles.bookmarks.bookmarks = { ... };
With:
${lib.showOption modulePath}.profiles.bookmarks.bookmarks = {
force = true;
settings = { ... };
};
''
];
nmt.script = ''
bookmarksUserJs=$(normalizeStorePaths \
"home-files/${cfg.profilesPath}/bookmarks/user.js")