Declare Firefox extensions and settings

This is very cool! Well done, especially since you’re new to the ecosystem.
Since you’ve looked at home-manager and the NUR, I echo the statements here that using the Firefox module is great once you get over the hump of setting it up.

The best example I’ve seen (and stolen from) is gvolpe’s nix config. Their Firefox module is here: https://github.com/gvolpe/nix-config/blob/6feb7e4f47e74a8e3befd2efb423d9232f522ccd/home/programs/browsers/firefox.nix

It also allows you to use all of rycee’s autoupdating extensions, listed in this (huge) file: https://github.com/nix-community/nur-combined/blob/cac5a762ec7c40a8489e8ba4efa4820ad4b23575/repos/rycee/pkgs/firefox-addons/addons.json

If you have specific questions getting this setup with flakes, please ask!

1 Like

Hello @billewanick, thanks a bunch for your post. I haven’t delved into the NUR yet, because I didn’t feel the need for it and also because I am uncertain on how trustworthy and reliable it is.

Its Readme states: " [The NUR] provides access to user repositories […]. In contrast to Nixpkgs, packages are built from source and are not reviewed by any Nixpkgs member."

Since you kindly offered to help, I’d like to take the opportunity and benefit from your experience by asking for more general information on the NUR, like how it is maintained, who can submit packages to it and how likely it is to break something if it is used. (In general, I prefer to stick to official repositories and avoid using third-party ones. So far I have had very good experiences with this strategy.) Thanks in advance for sharing your insights!

That’s great stuff! I came to the same conclusion regarding nur the last time I looked at it, and didn’t bother looking into how to do it manually. This works like a charm! :clap:

2 Likes

@sleepy what if a user would like to pin a specific extension? Is there an attribute for it?

You can use a versioned url.

Did anyone figured out how to declaratively configure the invidual firefox extensions?

I managed to configure ublock-origin to my liking:

but trying the same method for libredirect doesn’t work even though the configuration is set in the policies:

I had a hypothesis that maybe the extension wipes it’s config on deployment, but trying to deploy the policies on top of configured firefox also doesn’t work… Maybe the extension has to explicitly support this kind of configuration?


Asked upstream on Firefox configuration via `policies.json` on NixOS? · Issue #905 · libredirect/browser_extension · GitHub

This is how I installed a custom extension from https://addons.mozilla.org via nix that isn’t available in the NUR (with version pinning and no automatic update):

1 Like