nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
7.13k stars 1.84k forks source link

bug: importing a bookmarks.html can't be in nix store #5219

Open ghost opened 7 months ago

ghost commented 7 months ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

Okay, so, I'm trying to import a lot of bookmarks into Firefox. Works fine with something like this:

    programs.firefox = {
      enable = true;

      profiles.username = {
        settings = {
          "browser.bookmarks.file" = "${config.home.homeDirectory}/.dotfiles/nixos/modules/home-manager/firefox/bookmarks.html";
          "browser.places.importBookmarksHTML" = true;
        };
      };
    };

But, if I change the path to a, well path, instead of a string, no matter if relative or full, the resulting user.js contains the following:

user_pref("browser.bookmarks.file", "\"/nix/store/3rbwiydh7hwykzwiyq3wsf34n4zhyvni-bookmarks.html\"");

Notice the escaped quotation marks inside the quotation marks, Firefox will fail to import that file. Works fine if it's a string though, but it has the full path to my dotfiles-folder, not the Nix store, which feels very.. un-Nixy.

Not sure if this is maybe a Nix-issue, path to string conversion or something? I've tried looking in home-manager/modules/programs/firefox.nix but I'm so new to this whole ecosystem/language I couldn't quite figure out where the error was.

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 6.6.22, NixOS, 24.05 (Uakari), 24.05.20240325.57e6b3a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/nix/store/161i7cxz0w0raqmrj88z86cj66babp9z-source`
alyraffauf commented 4 months ago

Late to this, but just ran across some issues here myself. If you use string interpolation with a relative path, it should work. consider this:

    programs.firefox = {
      enable = true;

      profiles.username = {
        settings = {
          "browser.bookmarks.file" = "${./bookmarks.html}";
          "browser.places.importBookmarksHTML" = true;
        };
      };
    };

This assumes your .nix file and your bookmarks.html are in the same directory, of course. Adjust as necessary.

Here's my implementation: https://github.com/alyraffauf/nixcfg/blob/e829a2d4f85651d9fcf6fc9c884caf5c3a4523d1/homes/aly/firefox/default.nix#L22

stale[bot] commented 1 month ago

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 you are the original author of the issue

* 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 not the original author of the 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.

Memorandum on closing issues

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.