{ withKeePassXcAddon ? false , withPassffAddon ? false , withRedirectorAddon ? false , withSidebarTabsAddon ? false , firefoxAddons , lib , writeText , ... }: let firefoxAddonXpiPath = addon: "${addon}/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/${addon.addonId}.xpi"; in # See: https://mozilla.github.io/policy-templates/ writeText "policies.json" (builtins.toJSON { policies = { OverrideFirstRunPage = ""; OverridePostUpdatePage = ""; DisableAppUpdate = true; DisableSystemAddonUpdate = true; DisableFirefoxStudies = true; DisableTelemetry = true; DisableFeedbackCommands = true; SearchBar = "unified"; SearchSuggestEnabled = false; SearchEngines = { Add = [ { Alias = "sx"; Name = "SearXNG"; Description = "SearXNG — a privacy-respecting, open metasearch engine"; IconURL = "https://search.sapti.me/static/themes/simple/img/favicon.png"; URLTemplate = "https://search.sapti.me/search?q={searchTerms}"; } { Alias = "np"; Name = "NixOS Packages"; Description = "Search NixOS packages by name or description."; IconURL = "https://nixos.org/favicon.png"; URLTemplate = "https://search.nixos.org/packages?query={searchTerms}"; } { Alias = "no"; Name = "NixOS Options"; Description = "Search NixOS options by name or description."; IconURL = "https://nixos.org/favicon.png"; URLTemplate = "https://search.nixos.org/options?query={searchTerms}"; } ]; Default = "SearXNG"; Remove = [ "Google" "Bing" "Amazon.com" "eBay" "Twitter" "YouTube" "Yahoo" ]; }; FirefoxSuggest = { WebSuggestions = false; SponsoredSuggestions = false; ImproveSuggest = false; Locked = true; }; Preferences = { "layout.spellcheckDefault" = { Value = 0; Status = "locked"; }; }; Extensions = { Install = lib.optional withKeePassXcAddon (firefoxAddonXpiPath firefoxAddons.keepassxc-browser) ++ lib.optional withPassffAddon (firefoxAddonXpiPath firefoxAddons.passff) ++ lib.optional withRedirectorAddon (firefoxAddonXpiPath firefoxAddons.redirector) ++ lib.optional withSidebarTabsAddon (firefoxAddonXpiPath firefoxAddons.sidebartabs); Uninstall = [ "google@search.mozilla.org" "bing@search.mozilla.org" "amazondotcom@search.mozilla.org" "ebay@search.mozilla.org" "twitter@search.mozilla.org" "youtube@search.mozilla.org" "yahoo@search.mozilla.org" ]; }; }; })