Configuration.nix and select firefox search engine

I am experimenting with the Nixos configuration in configuration.nix.

Is it possible to customize the search engine for Firefox within configuration.nix? Standard SE is Google, but I prefer another SE.

That’s not a NixOS feature since it’s really about what’s in your home directory, but home-manager has some options to configure Firefox, including programs.firefox.profiles.<name>.settings which would let you set the relevant prefs.

This thread has some information on how to select search engines in firefox.cfg: How to modify Mozilla.cfg to set google as default search engine | Firefox Support Forum | Mozilla Support

1 Like

If I recall correctly, I did this by installing firefox-bin and then doing something like the following in a firefox.nix file:

{ config, pkgs, ... }:


environment.etc."firefox/policies/policies.json".text = ''
  "policies": {
     "SearchEngines": {
      "Default": "DuckDuckGo",
      "PreventInstalls": true