firefox: refactor bookmarks into a submodule & require force (#6402)

This splits the bookmarks submodule into a seperate file, to make it easier to maintain (like how the search module was previously split out in #5697).

This also refactors bookmarks to require a new force option, to be more explicit about overriding existing bookmarks.
This commit is contained in:
Kira Bruneau 2025-03-19 14:37:13 -04:00 committed by GitHub
parent 1727f417b7
commit 9d554281e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 317 additions and 231 deletions

View file

@ -7,12 +7,6 @@ let
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
withName = path:
pkgs.substituteAll {
src = path;
name = cfg.wrappedPackageName;
};
in {
imports = [ firefoxMockOverlay ];
@ -20,52 +14,56 @@ in {
enable = true;
profiles.bookmarks = {
settings = { "general.smoothScroll" = false; };
bookmarks = [
{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
}
{
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
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/";
}
];
}
];
}
];
bookmarks = {
force = true;
settings = [
{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
}
{
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url =
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
url = "https://www.kernel.org";
}
{
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 = ''
@ -74,7 +72,7 @@ in {
assertFileContent \
$bookmarksUserJs \
${withName ./expected-bookmarks-user.js}
${./expected-bookmarks-user.js}
bookmarksFile="$(sed -n \
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \

View file

@ -2,7 +2,7 @@
user_pref("browser.bookmarks.file", "/nix/store/00000000000000000000000000000000-@name@-bookmarks.html");
user_pref("browser.bookmarks.file", "/nix/store/00000000000000000000000000000000-bookmarks.html");
user_pref("browser.places.importBookmarksHTML", true);
user_pref("general.smoothScroll", false);

View file

@ -12,13 +12,16 @@ in {
main = {
isDefault = true;
id = 1;
bookmarks = [{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
bookmarks = {
force = true;
settings = [{
toolbar = true;
bookmarks = [{
name = "Home Manager";
url = "https://wiki.nixos.org/wiki/Home_Manager";
}];
}];
}];
};
containers = {
"shopping" = {
icon = "circle";