.files/nix/homeModules/common/firefox.nix
2025-08-24 11:11:04 +08:00

107 lines
3.3 KiB
Nix

{
pkgs,
config,
lib,
...
}: let
inherit (pkgs) nur;
cfg = config.programs.firefox;
in {
programs.firefox = {
# https://mozilla.github.io/policy-templates
# The following have more complex logic, keep them as policies and not profiles
policies = {
# Trans lations are of poor quality anyways
RequestedLocales = ["en-US"];
SearchEngines = {
Remove = ["Bing" "DuckDuckGo" "Qwant" "eBay"];
};
NoDefaultBookmarks = true;
DisplayMenuBar = "never";
DisplayBookmarksToolbar = "never";
DNSOverHTTPS = {
Enabled = true;
};
};
# https://searchfox.org/mozilla-central/source/browser/components/enterprisepolicies/Policies.sys.mjs
# Some policies can be rewritten to profiles configuration
profiles.default = {
settings = {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"browser.tabs.loadInBackground" = true;
"browser.ctrlTab.sortByRecentlyUsed" = false;
"layout.css.devPixelsPerPx" = 1.1;
# Sponsored crap
# Yes
"browser.newtabpage.activity-stream.showSearch" = true;
"browser.newtabpage.activity-stream.feeds.topsites" = true;
# No
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.feeds.section.highlights" = false;
"browser.newtabpage.activity-stream.feeds.system.topstories" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
# URL
# Yes
"browser.urlbar.suggest.quicksuggest.nonsponsored" = true;
# No
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
# Pasword manager
"signon.rememberSignons" = false;
"services.passwordSavingEnabled" = false;
"pref.privacy.disable_button.view_passwords" = false;
# Hardware acceleration
"layers.acceleration.disabled" = false;
# Screenshot
"screenshots.browser.component.enabled" = true;
# Recommendations
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
"extensions.htmlaboutaddons.recommendations.enabled" = false; # Addons
# Onboarding
"browser.aboutwelcome.enabled" = false;
# AI crap
"browser.ml.chat.enabled" = false;
};
extensions.packages = let
addons = nur.repos.rycee.firefox-addons;
in [
addons.ublock-origin
addons.privacy-badger
addons.user-agent-string-switcher
/*
Here's to you who want to remove news feed eradicator because you find it annoying:
It is here to annoy you so it is less likely for you to be on the agency inversion path.
DO NOT REMOVE IT. I repeat, DO NOT REMOVE IT.
If you think it's annoying, go do some jump rope, sing, live.
*/
addons.news-feed-eradicator # did you read the comment above?
addons.multi-account-containers
];
};
};
xdg.mimeApps = lib.mkIf cfg.enable {
enable = true;
associations.added = {
"text/html" = ["firefox.desktop"];
};
defaultApplications = {
"text/html" = ["firefox.desktop"];
};
};
}