Open D3vil0p3r opened 10 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.
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
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?