Open D3vil0p3r opened 5 months ago
I think I may have found a solution for this! A minimal example:
programs.firefox = {
enable = true;
profiles.bex = {
settings = {
"browser.bookmarks.file" = "/home/bex/.dotfiles/nixos/modules/home-manager/firefox/bookmarks.html";
"browser.places.importBookmarksHTML" = true;
};
};
};
I'm assuming there's a better way of getting the user's home directory in Nix, but I had some trouble and the absolute path worked. (I'm very new at Nix/NixOS/Home Manager.)
Edit: I'm assuming this will replace your bookmarks on every rebuild, so you have to be careful to re-export them if any changes are made.
You can use config.home.homeDirectory
to reference the user's home directory.
You could probably also reference the bookmarks path directly like:
"browser.bookmarks.file" = ./relative/path/to/bookmarks.html;
which will put it into the nix store (which you may or may not want). Also, Firefox might get mad if it can't write to the bookmarks file.
Ah, I'll give that one a go, thanks!
As for the relative path, it actually puts it in the store with a full path, if you skip the quotes around the path. The problem there is that the generated user.js
then contains something like this:
user_pref("browser.bookmarks.file", "\"/nix/store/3rbwiydh7hwykzwiyq3wsf34n4zhyvni-bookmarks.html\"");
Notice the escaped quotes within quotes, doesn't work, Firefox refuses to load them. I'm guessing this is some bug in the programs.firefox
-module of Home Manager, will look in to it some more and add a bug report for it.
Description
For users having hundreds of bookmarks to import can be very heavy to write them manually in nix file. Can you add the possibility in firefox module for HM to import HTML bookmark file in Firefox?