mozilla / nixpkgs-mozilla

Mozilla overlay for Nixpkgs.
MIT License
527 stars 129 forks source link

Firefox allow overriding with custom policy.json in distribution #247

Open toastal opened 3 years ago

toastal commented 3 years ago

Because the store is immutable (therefore the file in /distribution can't be modified)/and these bins don't appear to read from /etc/mozilla/firefox/policies, it would be ideal to have a way to inject some custom settings.

A web search did not reveal any clear or satisfactory ways to accomplish this all saying you need to build from source (which failed for me), or set the store to allow writing, or installing the bin from outside of Nix, or trying to inject the script into /run/user and then be picked up by Firefox after about:config flag is checked and browser restarted. All of these seem bad given Nix likes to have declarative config files.

nbp commented 3 years ago

Currently the policies.json is inherited from https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/browsers/firefox-bin/default.nix#L179

It is used as follow: https://github.com/mozilla/nixpkgs-mozilla/blob/master/firefox-overlay.nix#L142-L154

Which reuses the building expression from Nixpkgs, and replaces the source binary.

While this can be done without modifying Nixpkgs, I will highly suggest making it possible within Nixpkgs, such that this overlay can benefit from it as well. Otherwise, you might be able to a similar thing with overrideAttrs without modifying nor Nixpkgs nor this overlay.