Note that depending which settings is / are used to set bookmarks, different synthax are required.
Following places are configurable within home-manager.users."$USER_NAME".program.firefox
:
@ReedClanton home-manager
seems to be parsing “nix” dedicated bookmarks syntax into Netscape
format (.html
) in firefoxBookmarksFile bookmarks
function.
As an example:
{
home-manager.users."${USER}" = {
programs = {
firefox = {
enable = true;
policies = {
ManagedBookmarks = lib.importJSON ./managed-bookmarks.json;
};
profiles = {
# default profiles
default = {
id = 0;
name = "Default";
isDefault = true;
bookmarks = lib.importJSON ./default-bookmarks.json;
};
"alternative-profile" = {
id = 1;
name = "Alternative Profile";
bookmarks = lib.importJSON ./alternative-bookmarks.json;
}
}
};
};
};
}
Files:
// managed-bookmarks.json
[
{
"toplevel_name": "My Managed Bookmarks"
},
{
"url": "https://login.live.com/login.srf",
"name": "Microsoft 365"
},
{
"url": "https://github.com/login",
"name": "GitHub"
},
{
"name": "Nix",
"children": [
{
"url": "https://nixos.org/learn",
"name": "NixOS"
},
{
"url": "https://nixos.wiki/wiki/Main_Page",
"name": "NixOS Wiki"
},
{
"url": "https://search.nixos.org/packages",
"name": "Nix packages"
},
{
"url": "https://nix.dev/index.html",
"name": "Nix Dev"
}
]
}
]
// for profiles
// default-bookmarks.json
// alternative-bookmarks.json
[
{
"name": "Some bookmarks...", // directory name won't show if `toolbar = true`, first level will be level 0 in toolbar
"toolbar": true, // required to show in toolbar, else a directory in menu
"bookmarks": [
{
"url": "https://google.com#top-link-1",
"name": "Top Link #1"
},
{
"url": "https://google.com#top-link-2",
"name": "Top Link #2"
},
{
"name": "Nested Links #1",
"bookmarks": [
{
"url": "https://google.com#nested-link-1-1",
"name": "Nested Link #1"
},
{
"url": "https://google.com#nested-link-1-2",
"name": "Nested Link #2"
}
]
},
{
"name": "Nested Links #2",
"bookmarks": [
{
"url": "https://google.com#nested-link-2-1",
"name": "Nested Link #1"
},
{
"name": "Sub-Nested Links #1",
"bookmarks": [
{
"url": "https://google.com#sub-nested-link-1",
"name": "Sub-Nested Link #1"
},
{
"url": "https://google.com#sub-nested-link-2",
"name": "Sub-Nested Link #2"
}
]
}
]
}
]
}
]