1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-04-14 00:07:15 +00:00
home-manager/tests/modules/programs/firefox/profiles/bookmarks/attrset.nix
bricked 62d6a8931e firefox: fix bookmarks backwards compatibility
The legacy attrset option type for `firefox.profiles.<name>.bookmarks`
was accidentally removed in 9d55428. This adds back support for this
type by refactoring the bookmarks submodule. This also adds a new test
ensuring this won't happen again.
2025-03-23 14:04:01 -05:00

82 lines
2.1 KiB
Nix

modulePath:
{ config, lib, ... }:
let
cfg = lib.getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in {
imports = [ firefoxMockOverlay ];
config = lib.mkIf config.test.enableBig (lib.setAttrByPath modulePath {
enable = true;
profiles.bookmarks = {
settings = { "general.smoothScroll" = false; };
bookmarks = {
home-manager = {
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
};
wikipedia = {
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
};
kernel-org = {
name = "kernel.org";
url = "https://www.kernel.org";
};
nix-sites = {
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
tags = [ "wiki" "nix" ];
url = "https://wiki.nixos.org/";
}
{
name = "Nix sites";
bookmarks = [
{
name = "homepage";
url = "https://nixos.org/";
}
{
name = "wiki";
url = "https://wiki.nixos.org/";
}
];
}
];
};
};
};
} // {
nmt.script = ''
bookmarksUserJs=$(normalizeStorePaths \
home-files/${cfg.configPath}/bookmarks/user.js)
assertFileContent \
$bookmarksUserJs \
${./expected-bookmarks-user.js}
bookmarksFile="$(sed -n \
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
$TESTED/home-files/${cfg.configPath}/bookmarks/user.js)"
assertFileContent \
$bookmarksFile \
${./expected-bookmarks.html}
'';
});
}