1

I need to deploy my Firefox configured and with extensions in NixOS. I want to do that declaratively (in configuration.nix) and I do not want to use home-manager.

Firefox looks for the config in /nix/store/<hash>-firefox-unwrapped-74.0.1/lib/firefox/distribution/policies.json (verified with strace).

Hence the question: How do I add this file to the Firefox nixpkgs package? (Bonus question: How do I get a file from my Github Repo there?)

I'm rather new to NixOs. I consulted the manuals about overriding, overlays, wrapping and more but I couldn't manage to pull it off. I tried with both firefox, firefox-bin and firefox-unwrapped.

0

I took a glance at the firefox Nix expressions and didn't see a way to provide a policies.json.

If you modify the package such that you can provide the policy as an input to the derivation, it would work but then users would be forced the burden of compiling Firefox; Because the file would be a build input.

If Firefox provides a way to specify where to find the policies file at runtime, that might be an ideal solution. Otherwise, you can add a patch to the Firefox package which modifies the source code to look for the policies file at say... /etc/firefox/policies.json. With that change in place, you can use the environment NixOS module in /etc/nixos/configuration.nix to create the policies. Something like this:

environment.etc."firefox/policies".text = "INSERT POLICY HERE";
1
  • 1
    After a look in the source code, I actually found a way: setting the preference toolkit.policies.perUserDir to true will result in Firefox looking for /run/user/1000/firefox/policies. – MemAllox Apr 16 '20 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.