Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firefox: split bookmarks into separate submodule file #6402

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kira-bruneau
Copy link
Contributor

@kira-bruneau kira-bruneau commented Feb 3, 2025

Description

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).

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all
    or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@brckd @rycee

@@ -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");
Copy link
Contributor Author

@kira-bruneau kira-bruneau Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app name isn't necessary for this file, so I just removed it to make things simpler.

@brckd
Copy link
Contributor

brckd commented Feb 4, 2025

Thanks for your contribution! I like the direction you're going with splitting everything into selfcontained submodules.

I see that you renamed the bookmarks option to bookmarkSubmodule.bookmarks. I don't think we should put implementation details ("submodule") in the option name, since that's nothing the user would be concerned about. I suggest calling it bookmarks.settings instead, as that would be in line with #6389's extensions.settings.

Apart from that it looks good to me!

@brckd
Copy link
Contributor

brckd commented Feb 4, 2025

Did you add yourself as maintainer for the module?

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Feb 4, 2025

I see that you renamed the bookmarks option to bookmarksSubmodule.bookmarks. I don't think we should put implementation details ("submodule") in the option name, since that's nothing the user would be concerned about. I suggest calling it bookmarks.settings instead, as that would be in line with #6389's extensions.settings.

Oh yep, that's why I kept that option as internal so it won't be exposed to the user. The alias I added for bookmarks -> bookmarkSubmodule.bookmarks should keep the existing structure, to avoid a breaking change.

Did you add yourself as maintainer for the module?

Oh nope, I'm not too familiar with the bookmarks code and I don't use it myself. I was just going through other options that could be broken out into submodules (without any existing related PRs to avoid merge conflicts). I'm not quite sure who'd be best to add here 🤔 - would it be ok to add you and @rycee?

@ethorsoe, would you be interested in being the maintainer since you originally added bookmarks support in #2355?

@kira-bruneau
Copy link
Contributor Author

kira-bruneau commented Feb 4, 2025

Oh wait, actually I like the idea of the submodule matching NixOS/rfcs#42.

I'll rename bookmarksSubmodule.bookmarks -> bookmarksSubmodule.settings & bookmarksSubmodule.file -> bookmarksSubmodule.configFile, but I'll still keep the alias to avoid a breaking change.

@kira-bruneau kira-bruneau force-pushed the split-firefox-bookmarks branch 4 times, most recently from f562152 to b7add2c Compare February 4, 2025 18:26
@brckd
Copy link
Contributor

brckd commented Feb 4, 2025

Oh yep, that's why I kept that option as internal so it won't be exposed to the user.

Oh, I didn't catch that! In that case it shouldn't matter what the option containing the submodule is called.

@kira-bruneau
Copy link
Contributor Author

Hmmmm, I'm realizing that like the search submodule, this could potentially override any existing bookmarks.

I was planning on making the enable option for the search module act as the new force option, so I think it would make sense to do the same here.

That would be a breaking change though 😅 - I guess there's no point trying to avoid it.

@kira-bruneau kira-bruneau force-pushed the split-firefox-bookmarks branch from b7add2c to eee18d9 Compare February 4, 2025 20:06
@kira-bruneau
Copy link
Contributor Author

Ok it should be good now!

description = "Bookmark tags.";
};
type = (with types;
coercedTo (listOf anything) (bookmarks:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used (listOf anything) here because I couldn't find a nice way to pull out the original type from the submodule.

I don't believe this is an issue since this will just redirect you to the new submodule format.

@kira-bruneau
Copy link
Contributor Author

Ok, I decided to add myself as a maintainer, since this change ended up becoming more than just a simple refactor, and I feel familiar enough with the code now.

Ideally it'd be nice to have a maintainer who actually uses this feature though!

I'm realizing, I might actually reconsider adding myself back as maintainer for all of firefox once we have everything organized out into smaller submodule files.

@kira-bruneau kira-bruneau force-pushed the split-firefox-bookmarks branch from 7475712 to 31fd994 Compare February 6, 2025 14:52
@kira-bruneau kira-bruneau force-pushed the split-firefox-bookmarks branch from 31fd994 to c382fd6 Compare February 6, 2025 15:01
@@ -786,9 +660,9 @@ in {

"${profilesPath}/${profile.path}/user.js" = mkIf (profile.preConfig != ""
|| profile.settings != { } || profile.extraConfig != ""
|| profile.bookmarks != [ ]) {
|| profile.bookmarks.enable) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this change the compatibility, with existing configs and if so why is it done?

@brckd
Copy link
Contributor

brckd commented Feb 7, 2025

I was planning on making the enable option for the search module act as the new force option, so I think it would make sense to do the same here.

That would be a breaking change though 😅 - I guess there's no point trying to avoid it.

I still prefer force since IMO the module should be enabled implicitly and force be used only in case something needs to be overridden. It's also more explicit about overriding something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants