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

346 lines
11 KiB
Nix
Raw Normal View History

{ pkgs, nixgl, ... }:
2024-11-03 18:28:10 +00:00
let
lock-false = {
Value = false;
Status = "locked";
};
lock-true = {
Value = true;
Status = "locked";
};
nixGL = "${nixgl.packages.${pkgs.system}.nixGLIntel}/bin/nixGLIntel";
my-firefox = (pkgs.firefox.override {
2024-11-15 20:27:19 +00:00
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);
// New sidebar
lockPref("sidebar.revamp", true);
lockPref("sidebar.verticalTabs", true);
lockPref("sidebar.visibility", "always-show");
lockPref("sidebar.main.tools", "");
//
'';
}).overrideAttrs (old: {
buildCommand = old.buildCommand + ''
sed -i "s#firefox-wrapped\"#firefox-wrapped\" \"${nixGL}\"#1" "$out/bin/firefox"
'';
});
in
{
programs.firefox = {
enable = true;
package = my-firefox;
2024-11-03 18:28:10 +00:00
policies = {
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
2024-11-04 04:16:07 +00:00
EmailTracking = true;
2024-11-03 18:28:10 +00:00
};
# Certificates
Certificates = {
ImportEnterpriseRoots = true;
Install = [
"freya_ca.crt"
"tinternet.crt"
];
2024-11-03 18:28:10 +00:00
};
# Cookies
Cookies = {
Behavior = "reject-foreign";
2024-11-04 04:16:07 +00:00
BehaviorPrivateBrowsing = "reject-foreign";
2024-11-03 18:28:10 +00:00
Locked = true;
};
# DNS
DNSOverHTTPS = {
Enabled = false;
Locked = true;
};
# Disable Bad
DisableAppUpdate = true;
DisableAccounts = true;
DisableFirefoxAccounts = true;
DisableFirefoxScreenshots = true;
DisableFirefoxStudies = true;
2024-11-04 04:16:07 +00:00
DisablePocket = true;
2024-11-03 18:28:10 +00:00
DisableTelemetry = true;
AutofillAddressEnabled = false;
AutofillCreditCardEnabled = false;
# Disable Certain Messages
UserMessaging = {
WhatsNew = false;
ExtensionRecommendations = false;
FeatureRecommendations = false;
UrlbarInterventions = false;
SkipOnboarding = true;
MoreFromMozilla = false;
2024-11-04 04:16:07 +00:00
Labs = false;
2024-11-03 18:28:10 +00:00
Locked = true;
};
# Disable Password Manager
2024-11-13 17:43:29 +00:00
DisableMasterPasswordCreation = true;
2024-11-03 18:28:10 +00:00
PasswordManagerEnabled = false;
2024-11-04 04:16:07 +00:00
PrimaryPassword = false;
2024-11-03 18:28:10 +00:00
OfferToSaveLogins = false;
# Remove Special Pages
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
# Start Page
Homepage = {
StartPage = "previous-session";
2024-11-15 20:27:19 +00:00
Locked = true;
2024-11-03 18:28:10 +00:00
};
# Home Page
FirefoxHome = {
Search = true;
TopSites = false;
SponsoredTopSites = false;
Highlights = false;
Pocket = false;
SponsoredPocket = false;
Snippets = false;
Locked = true;
};
# Search Suggestions
2024-11-04 04:16:07 +00:00
SearchSuggestEnabled = true;
2024-11-03 18:28:10 +00:00
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;
};
2024-11-04 04:16:07 +00:00
# Popups
PopupBlocking = {
Default = true;
Locked = true;
};
# Allow Bypasses
DisableSecurityBypass = {
InvalidCertificate = false;
SafeBrowsing = false;
};
# PictureInPicure
PictureInPicture = {
Enabled = true;
Locked = true;
};
# Topbar
2024-11-03 18:28:10 +00:00
SearchBar = "unified";
DisplayMenuBar = "default-off";
DisplayBookmarksToolbar = "newtab";
NoDefaultBookmarks = true;
2024-11-04 04:16:07 +00:00
# Miscellaneous
HttpsOnlyMode = "force_enabled";
2024-11-03 18:28:10 +00:00
HardwareAcceleration = true;
DontCheckDefaultBrowser = true;
PromptForDownloadLocation = false;
2024-11-04 04:16:07 +00:00
PrivateBrowsingModeAvailability = 0;
2024-11-03 18:28:10 +00:00
# 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";
};
2024-11-17 20:35:19 +00:00
# FoxyProxy
"foxyproxy@eric.h.jung" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi";
installation_mode = "force_installed";
};
2024-11-03 18:28:10 +00:00
};
# about:config Preferences
Preferences = {
# theme
"toolkit.legacyUserProfileCustomizations.stylesheets" = lock-true;
2024-11-04 04:16:07 +00:00
"extensions.activeThemeID" = {
Value = "firefox-compact-dark@mozilla.org";
Status = "locked";
};
2024-11-15 20:27:19 +00:00
"layout.css.prefers-color-scheme.content-override" = {
Value = 0;
Status = "locked";
};
2024-11-04 04:16:07 +00:00
# homepage
"browser.startup.homepage" = {
Value = " about:home";
Status = "locked";
};
"browser.newtabpage.enabed" = lock-true;
"browser.newtabpage.url" = {
Value = " about:home";
Status = "locked";
};
2024-11-13 17:43:29 +00:00
# autofill
"browser.autofill.enabled" = lock-false;
"browser.formfill.enable" = lock-false;
2024-11-04 04:16:07 +00:00
# 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;
2024-11-03 18:28:10 +00:00
# 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;
2024-11-03 18:28:10 +00:00
# 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;
2024-11-15 20:27:19 +00:00
"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";
};
2024-11-04 04:16:07 +00:00
# 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;
2024-11-09 23:16:54 +00:00
# sidebar
2024-11-13 17:43:29 +00:00
"browser.tabs.inTitlebar" = {
Value = 0;
Status = "locked";
};
"browser.tabs.warnOnClose" = lock-true;
"browser.tabs.firefox-view" = lock-false;
2024-11-09 23:16:54 +00:00
"browser.tabs.closeTabByDblclick" = lock-true;
"ui.key.menuAccessKeyFocuses" = lock-false;
2024-11-13 17:43:29 +00:00
# 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;
2024-11-04 04:16:07 +00:00
};
};
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;
};
2024-11-04 04:16:07 +00:00
};
userChrome = ''
2024-11-09 23:16:54 +00:00
#sidebar-header { display:none !important; }
#sidebar-search-container { display:none !important; }
2024-11-04 04:16:07 +00:00
#firefox-view-button {
visibility: collapse;
}
#alltabs-button {
visibility: collapse;
}
#tabbrowser-tabs {
border-inline-start: none !important;
}
'';
2024-11-03 18:28:10 +00:00
};
};
};
}