{ config, pkgs, ... }: { programs.firefox = { enable = true; package = let devPixelsPerPx = 1.2; prefs = { # about:config preferences # We're setting them via extraPrefs because policies.Preferences doesn't support all about:config preferences. # Make everything a bit bigger (with this the default Firefox font size matches my terminal font size of 14pt). "layout.css.devPixelsPerPx" = toString devPixelsPerPx; # With Ctrl+- I want to get get devicePixelRatio=1. "toolkit.zoomManager.zoomValues" = ".3,.5,.67,${toString (1 / devPixelsPerPx)},1,1.1,1.2,1.33,1.5,1.7,2,2.4,3,4,5"; "browser.aboutConfig.showWarning" = false; "browser.ml.chat.menu" = false; "browser.tabs.insertAfterCurrent" = true; "browser.translations.automaticallyPopup" = false; "browser.uidensity" = 1; # For Actual Budget which requires a secure context. This domain points to ev's tailscale IP. # Using a separate domain rather than ev.tailnet because this preference doesn't support ports (https://connect.mozilla.org/t5/ideas/-/idi-p/116011) # and the https upgrading breaks other web apps. "dom.securecontext.allowlist" = "ev.push-f.com"; "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked "identity.fxaccounts.enabled" = false; "sidebar.revamp" = false; # with the revamped sidebar Ctrl+B opens but not closes the sidebar which is annoying "toolkit.legacyUserProfileCustomizations.stylesheets" = true; }; in (pkgs.wrapFirefox pkgs.firefox-unwrapped { extraPrefs = with pkgs.lib; '' ${concatStrings ( mapAttrsToList (name: value: '' lockPref("${name}", ${builtins.toJSON value}); '') prefs )} ''; }); policies = { DontCheckDefaultBrowser = true; DisablePocket = true; FirefoxHome = { SponsoredTopSites = false; }; SearchSuggestEnabled = false; # cannot use SearchEngines because it's only available on ESR :( # (https://mozilla.github.io/policy-templates/#searchengines-this-policy-is-only-available-on-the-esr) ExtensionSettings = { "uBlock0@raymondhill.net" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; installation_mode = "force_installed"; }; }; PasswordManagerEnabled = false; AutofillCreditCardEnabled = false; ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; installation_mode = "force_installed"; }; }; }; }