dotfiles-guix/home/nix/programs/firefox.nix

346 lines
11 KiB
Nix

{ pkgs ... }:
let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
in
{
programs.firefox = {
enable = true;
package = pkgs.firefox.override {
extraPrefs = ''
//
// Automatically click cookiebanners although uBlock Origin might block them
lockPref("cookiebanners.bannerClicking.enabled", true);
lockPref("cookiebanners.service.mode", 2);
lockPref("cookiebanners.service.mode.privateBrowsing", 2);
// DNT although PrivacyBadger from policy handles this
lockPref("privacy.donottrackheader.enabled", true);
lockPref("privacy.donottrackheader.value", 1);
// Fingerprinting
lockPref("privacy.fingerprintingProtection", true);
pref(
"privacy.fingerprintingProtection.overrides",
"+AllTargets,-KeyboardEvents,-SpeechSynthesis,-CSSPrefersColorScheme,-CSSPrefersReducedMotion,-NavigatorUserAgent,-JSDateTimeUTC,-HttpUserAgent",
);
lockPref("privacy.fingerprintingProtection.pbmode", true);
lockPref("privacy.resistFingerprinting", false);
lockPref("privacy.resistFingerprinting.block_mozAddonManage", true);
lockPref("privacy.resistFingerprinting.letterboxing", false);
clearPref("privacy.resistFingerprinting.pbmode");
// New sidebar
lockPref("sidebar.revamp", true);
lockPref("sidebar.verticalTabs", true);
lockPref("sidebar.visibility", "always-show");
lockPref("sidebar.main.tools", "");
//
'';
};
policies = {
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
EmailTracking = true;
};
# Certificates
Certificates = {
ImportEnterpriseRoots = true;
Install = [
"freya_ca.crt"
"tinternet.crt"
];
};
# Cookies
Cookies = {
Behavior = "reject-foreign";
BehaviorPrivateBrowsing = "reject-foreign";
Locked = true;
};
# DNS
DNSOverHTTPS = {
Enabled = false;
Locked = true;
};
# Disable Bad
DisableAppUpdate = true;
DisableAccounts = true;
DisableFirefoxAccounts = true;
DisableFirefoxScreenshots = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
AutofillAddressEnabled = false;
AutofillCreditCardEnabled = false;
# Disable Certain Messages
UserMessaging = {
WhatsNew = false;
ExtensionRecommendations = false;
FeatureRecommendations = false;
UrlbarInterventions = false;
SkipOnboarding = true;
MoreFromMozilla = false;
Labs = false;
Locked = true;
};
# Disable Password Manager
DisableMasterPasswordCreation = true;
PasswordManagerEnabled = false;
PrimaryPassword = false;
OfferToSaveLogins = false;
# Remove Special Pages
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
# Start Page
Homepage = {
StartPage = "previous-session";
Locked = true;
};
# Home Page
FirefoxHome = {
Search = true;
TopSites = false;
SponsoredTopSites = false;
Highlights = false;
Pocket = false;
SponsoredPocket = false;
Snippets = false;
Locked = true;
};
# Search Suggestions
SearchSuggestEnabled = true;
FirefoxSuggest = {
WebSuggestions = false;
SponsoredSuggestions = false;
ImproveSuggest = false;
Locked = true;
};
# Save All on Shutdown
SanitizeOnShutdown = {
Cache = false;
Cookies = false;
Downloads = false;
Histroy = false;
Sessions = false;
SiteSettings = false;
OfflineApps = false;
Locked = true;
};
# Popups
PopupBlocking = {
Default = true;
Locked = true;
};
# Allow Bypasses
DisableSecurityBypass = {
InvalidCertificate = false;
SafeBrowsing = false;
};
# PictureInPicure
PictureInPicture = {
Enabled = true;
Locked = true;
};
# Topbar
SearchBar = "unified";
DisplayMenuBar = "default-off";
DisplayBookmarksToolbar = "newtab";
NoDefaultBookmarks = true;
# Miscellaneous
HttpsOnlyMode = "force_enabled";
HardwareAcceleration = true;
DontCheckDefaultBrowser = true;
PromptForDownloadLocation = false;
PrivateBrowsingModeAvailability = 0;
# Extensions
ExtensionSettings = {
"*".installation_mode = "blocked";
# uBlock Origin
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
# Bitwarden
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
installation_mode = "force_installed";
};
# User Agent Switcher
"user-agent-switcher@ninetailed.ninja" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/uaswitcher/latest.xpi";
installation_mode = "force_installed";
};
# SponsorBlock
"sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi";
installation_mode = "force_installed";
};
# Privacy Badger
"jid1-MnnxcxisBPnSXQ@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi";
installation_mode = "force_installed";
};
};
# about:config Preferences
Preferences = {
# theme
"toolkit.legacyUserProfileCustomizations.stylesheets" = lock-true;
"extensions.activeThemeID" = {
Value = "firefox-compact-dark@mozilla.org";
Status = "locked";
};
"layout.css.prefers-color-scheme.content-override" = {
Value = 0;
Status = "locked";
};
# homepage
"browser.startup.homepage" = {
Value = " about:home";
Status = "locked";
};
"browser.newtabpage.enabed" = lock-true;
"browser.newtabpage.url" = {
Value = " about:home";
Status = "locked";
};
# autofill
"browser.autofill.enabled" = lock-false;
"browser.formfill.enable" = lock-false;
# search enable
"browser.urlbar.suggest.recentsearches" = lock-true;
"browser.urlbar.suggest.bookmark" = lock-true;
"browser.urlbar.suggest.clipboard" = lock-true;
"browser.urlbar.suggest.history" = lock-true;
# search disable
"browser.urlbar.suggest.addons" = lock-false;
"browser.urlbar.suggest.calculator" = lock-false;
"browser.urlbar.suggest.engines" = lock-false;
"browser.urlbar.suggest.fakespot" = lock-false;
"browser.urlbar.suggest.mdn" = lock-false;
"browser.urlbar.suggest.openpage" = lock-false;
"browser.urlbar.suggest.pocket" = lock-false;
"browser.urlbar.suggest.remotetab" = lock-false;
"browser.urlbar.suggest.topsites" = lock-false;
"browser.urlbar.suggest.trending" = lock-false;
"browser.urlbar.suggest.weather" = lock-false;
"browser.urlbar.suggest.yelp" = lock-false;
# privacy
"privacy.globalprivacycontrol.enabled" = lock-true;
# security
"security.OCSP.enabled" = {
Value = 0;
Status = "locked";
};
"browser.contentblocking.category" = {
Value = "strict";
Status = "locked";
};
"xpinstall.whitelist.required" = lock-true;
"signon.management.page.breach-alerts.enabled" = lock-false;
# graphics
"dom.webgpu.enabled" = lock-true;
"media.eme.enabled" = lock-true;
# user messaging
"browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
"browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false;
"browser.newtabpage.activity-stream.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.system.showSponsored" = lock-false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
"browser.newtabpage.activity-stream.showWeather" = lock-false;
"browser.newtabpage.activity-stream.newtabWallpapers.enabled" = lock-false;
"browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled" = lock-false;
"browser.newtabpage.activity-stream.default.sites" = {
Value = "";
Status = "locked";
};
# safebrowsing
"browser.safebrowsing.malware.enabled" = lock-true;
"browser.safebrowsing.phishing.enabled" = lock-true;
"browser.safebrowsing.downloads.enabled" = lock-true;
"browser.safebrowsing.downloads.remote.block_uncommon" = lock-false;
"browser.safebrowsing.downloads.remote.block_potentially_unwanted" = lock-false;
# sidebar
"browser.tabs.inTitlebar" = {
Value = 0;
Status = "locked";
};
"browser.tabs.warnOnClose" = lock-true;
"browser.tabs.firefox-view" = lock-false;
"browser.tabs.closeTabByDblclick" = lock-true;
"ui.key.menuAccessKeyFocuses" = lock-false;
# general settings
"general.autoScroll" = lock-false;
"general.smoothScroll" = lock-true;
"widget.gtk.overlay-scrollbars.enabled" = lock-false;
"accessibility.browsewithcaret" = lock-false;
"accessibility.typeaheadfind" = lock-false;
"media.hardwaremediakeys.enabled" = lock-true;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = lock-false;
"browser.aboutConfig.showWarning" = lock-false;
};
};
profiles = {
"freya" = {
search = {
force = true;
default = "DuckDuckGo";
engines = {
"Google".metaData.hidden = true;
"Bing".metaData.hidden = true;
"Amazon.com".metaData.hidden = true;
"eBay".metaData.hidden = true;
"Twitter".metaData.hidden = true;
};
};
userChrome = ''
#sidebar-header { display:none !important; }
#sidebar-search-container { display:none !important; }
#firefox-view-button {
visibility: collapse;
}
#alltabs-button {
visibility: collapse;
}
#tabbrowser-tabs {
border-inline-start: none !important;
}
'';
};
};
};
}