nix/home-mods/firefox/_base.nix

416 lines
17 KiB
Nix

{ config
, lib
, pkgs
, ...
}: {
enable = true;
# package = pkgs.firefox;
profiles = {
default = {
isDefault = true;
# userChrome = ''
# @-moz-document url(chrome://browser/content/browser.xhtml) {
# /* tabs on bottom of window */
# /* requires that you set
# * toolkit.legacyUserProfileCustomizations.stylesheets = true
# * in about:config
# */
# #main-window body { flex-direction: column-reverse !important; }
# #navigator-toolbox { flex-direction: column-reverse !important; }
# #urlbar {
# top: unset !important;
# bottom: calc(var(--urlbar-margin-inline)) !important;
# box-shadow: none !important;
# display: flex !important;
# flex-direction: column !important;
# }
# #urlbar > * {
# flex: none;
# }
# #urlbar-input-container {
# order: 2;
# }
# #urlbar > .urlbarView {
# order: 1;
# border-bottom: 1px solid #666;
# }
# #urlbar-results {
# display: flex;
# flex-direction: column-reverse;
# }
# .search-one-offs { display: none !important; }
# .tab-background { border-top: none !important; }
# #navigator-toolbox::after { border: none; }
# #TabsToolbar .tabbrowser-arrowscrollbox,
# #tabbrowser-tabs, .tab-stack { min-height: 28px !important; }
# .tabbrowser-tab { font-size: 80%; }
# .tab-content { padding: 0 5px; }
# .tab-close-button .toolbarbutton-icon { width: 12px !important; height: 12px !important; }
# toolbox[inFullscreen=true] { display: none; }
# /*
# * the following makes it so that the on-click panels in the nav-bar
# * extend upwards, not downwards. some of them are in the #mainPopupSet
# * (hamburger + unified extensions), and the rest are in
# * #navigator-toolbox. They all end up with an incorrectly-measured
# * max-height (based on the distance to the _bottom_ of the screen), so
# * we correct that. The ones in #navigator-toolbox then adjust their
# * positioning automatically, so we can just set max-height. The ones
# * in #mainPopupSet do _not_, and so we need to give them a
# * negative margin-top to offset them *and* a fixed height so their
# * bottoms align with the nav-bar. We also calc to ensure they don't
# * end up overlapping with the nav-bar itself. The last bit around
# * cui-widget-panelview is needed because "new"-style panels (those
# * using "unified" panels) don't get flex by default, which results in
# * them being the wrong height.
# *
# * Oh, yeah, and the popup-notification-panel (like biometrics prompts)
# * of course follows different rules again, and needs its own special
# * rule.
# */
# #mainPopupSet panel.panel-no-padding { margin-top: calc(-50vh + 40px) !important; }
# #mainPopupSet .panel-viewstack, #mainPopupSet popupnotification { max-height: 50vh !important; height: 50vh; }
# #mainPopupSet panel.panel-no-padding.popup-notification-panel { margin-top: calc(-50vh - 35px) !important; }
# #navigator-toolbox .panel-viewstack { max-height: 75vh !important; }
# panelview.cui-widget-panelview { flex: 1; }
# panelview.cui-widget-panelview > vbox { flex: 1; min-height: 50vh; }
# }
# '';
settings = {
# Search foo
"browser.search.suggest.enabled" = true;
"browser.search.suggest.enabled.private" = false;
"browser.search.update" = false;
"services.sync.prefs.sync.browser.search.update" = false;
# Disable internal passwod manager
"signon.rememberSignons" = false;
# Extensions are managed with Nix, so don't update.
"extensions.update.autoUpdateDefault" = false;
"extensions.update.enabled" = false;
# Default Apps are also managed via Nix
"browser.shell.checkDefaultBrowser" = false;
# Default to dark theme in DevTools panel
"devtools.theme" = "dark";
# Reduce search engine noise in the urlbar's completion window. The
# shortcuts and suggestions will still work, but Firefox won't clutter
# its UI with reminders that they exist.
"browser.urlbar.suggest.searches" = true; # Let's hope duckduckgo doesn't sell it all :)
"browser.urlbar.shortcuts.bookmarks" = true;
"browser.urlbar.shortcuts.history" = true;
"browser.urlbar.shortcuts.tabs" = true;
"browser.urlbar.showSearchSuggestionsFirst" = false;
"browser.urlbar.speculativeConnect.enabled" = false;
"browser.urlbar.suggest.quicksuggest.nonsponsored" = false;
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
# Disable some not so useful functionality.
"browser.disableResetPrompt" = true; # "Looks like you haven't started Firefox in a while."
"browser.onboarding.enabled" = false; # "New to Firefox? Let's get started!" tour
"browser.aboutConfig.showWarning" = false; # Warning when opening about:config
"extensions.pocket.enabled" = false;
"extensions.shield-recipe-client.enabled" = false;
# Sync
# "services.sync.username" = config.etu.user.email;
"services.sync.engine.addons" = false; # Do not sync extensions.
"general.autoScroll" = true; # Middle click to scroll
"browser.startup.page" = 3; # Restore previous windows and tabs.
# Security-oriented defaults
"security.family_safety.mode" = 0;
# https://blog.mozilla.org/security/2016/10/18/phasing-out-sha-1-on-the-public-web/
"security.pki.sha1_enforcement_level" = 1;
# https://github.com/tlswg/tls13-spec/issues/1001
"security.tls.enable_0rtt_data" = false;
# Use Mozilla geolocation service instead of Google if given permission
"geo.provider.network.url" = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%";
"geo.provider.use_gpsd" = false;
# https://support.mozilla.org/en-US/kb/extension-recommendations
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
"extensions.htmlaboutaddons.recommendations.enabled" = false;
"extensions.htmlaboutaddons.discover.enabled" = false;
"extensions.htmlaboutaddons.inline-options.enabled" = false;
"extensions.getAddons.showPane" = false; # uses Google Analytics
"browser.discovery.enabled" = false;
# Privacy enhancements
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.snippets" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
# Improve performance
"gfx.webrender.all" = true;
# Enable ETP for decent security (makes firefox containers and many
# common security/privacy add-ons redundant).
"browser.contentblocking.category" = "strict";
"privacy.purge_trackers.enabled" = true;
# Do Not Track header
"privacy.donottrackheader.enabled" = true;
"privacy.donottrackheader.value" = 1;
# Disable Private Attribution Tracking Foo
"dom.private-attribution.submission.enabled" = false;
# Your customized toolbar settings are stored in
# 'browser.uiCustomization.state'. This tells firefox to sync it between
# machines. WARNING: This may not work across OSes. Since I use NixOS on
# all the machines I use Firefox on, this is no concern to me.
"services.sync.prefs.sync.browser.uiCustomization.state" = true;
# Enable userChrome customisations
"toolkit.legacyUserProfileCustomizations.stylesheets" = false; # TODO Reenable with fixed tabs on bottom css
# Reduce File IO / SSD abuse
# Otherwise, Firefox bombards the HD with writes. Not so nice for SSDs.
# This forces it to write every 15 minutes, rather than 15 seconds.
"browser.sessionstore.interval" = "900000";
# Disable battery API
"dom.battery.enabled" = false;
# Disable "beacon" asynchronous HTTP transfers (used for analytics)
"beacon.enabled" = false;
# Disable pinging URIs specified in HTML <a> ping= attributes
"browser.send_pings" = false;
# Disable gamepad API to prevent USB device enumeration
"dom.gamepad.enabled" = false;
# Don't try to guess domain names when entering an invalid domain name in URL bar
"browser.fixup.alternate.enabled" = false;
# Disable telemetry
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.server" = "data:,";
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.coverage.opt-out" = true;
"toolkit.coverage.opt-out" = true;
"toolkit.coverage.endpoint.base" = "";
"experiments.supported" = false;
"experiments.enabled" = false;
"experiments.manifest.uri" = "";
"browser.ping-centre.telemetry" = false;
# https://mozilla.github.io/normandy/
"app.normandy.enabled" = false;
"app.normandy.api_url" = "";
"app.shield.optoutstudies.enabled" = false;
# Disable health reports (basically more telemetry)
# https://support.mozilla.org/en-US/kb/firefox-health-report-understand-your-browser-perf
# https://gecko.readthedocs.org/en/latest/toolkit/components/telemetry/telemetry/preferences.html
"datareporting.healthreport.uploadEnabled" = false;
"datareporting.healthreport.service.enabled" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
# Disable crash reports
"breakpad.reportURL" = "";
"browser.tabs.crashReporting.sendReport" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false; # don't submit backlogged reports
# Disable Form autofill
# https://wiki.mozilla.org/Firefox/Features/Form_Autofill
"browser.formfill.enable" = false;
"extensions.formautofill.addresses.enabled" = false;
"extensions.formautofill.available" = "off";
"extensions.formautofill.creditCards.available" = false;
"extensions.formautofill.creditCards.enabled" = false;
"extensions.formautofill.heuristics.enabled" = false;
# VAAPI ffmpeg foo
"media.ffmpeg.vaapi.enabled" = true;
};
extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
# clearurls
# leechblock-ng
# localcdn
# skip-redirect
# unpaywall
bitwarden
consent-o-matic
darkreader
dearrow
deutsch-de-language-pack
dictionary-german
df-youtube
flagfox
ipvfoo
kagi-search
plasma-integration
privacy-badger
rust-search-extension
sidebery
sponsorblock
tab-stash
ublock-origin
];
# TODO Reenable when fixed (currently works for setup but default settings is broken due to https://github.com/nix-community/home-manager/pull/6505#issuecomment-2673463728)
# search = {
# force = true;
# default = "Kagi";
# privateDefault = "DuckDuckGo";
# # default = "DuckDuckGo";
# # privateDefault = "Kagi";
# order = [ "Kagi" "DuckDuckGo" "Nix Packages" "Nix Options" "NixOS Wiki" "Home-Manager Options" ];
# engines = {
# "Kagi" = {
# id = "eacf4b1a-4c8a-4b75-abeb-6ae09e5ef4ae";
# urls = [{ template = "https://kagi.com/search?q={searchTerms}"; }];
# definedAliases = [ "@k" ];
# iconUpdateURL = "https://kagi.com/favicon.ico";
# updateInterval = 24 * 60 * 60 * 1000; # every day
# };
# "DuckDuckGo".metaData = {
# alias = "@ddg";
# };
# "Nix Packages" = {
# urls = [
# {
# template = "https://search.nixos.org/packages";
# params = [
# {
# name = "type";
# value = "packages";
# }
# {
# name = "query";
# value = "{searchTerms}";
# }
# ];
# }
# ];
# icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
# definedAliases = [ "@np" ];
# };
# "Nix Options" = {
# urls = [
# {
# template = "https://search.nixos.org/options";
# params = [
# {
# name = "type";
# value = "options";
# }
# {
# name = "query";
# value = "{searchTerms}";
# }
# ];
# }
# ];
# icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
# definedAliases = [ "@no" ];
# };
# "Home-Manager Options" = {
# urls = [
# {
# template = "https://home-manager-options.extranix.com";
# params = [
# {
# name = "query";
# value = "{searchTerms}";
# }
# {
# name = "release";
# value = "master";
# }
# ];
# }
# ];
# icon = "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
# definedAliases = [ "@ho" ];
# };
# "NixOS Wiki" = {
# urls = [
# {
# template = "https://nixos.wiki/index.php?search={searchTerms}";
# }
# ];
# iconUpdateURL = "https://nixos.wiki/favicon.png";
# definedAliases = [ "@nw" ];
# };
# "Bing".metaData.hidden = true;
# "Amazon.de".metaData.hidden = true;
# "Google".metaData.hidden = true;
# };
# };
# TODO Check if possible to reenable without breaking tab stash ?
# This currently overwrites existing bookmarks which kinda sucks.....
# bookmarks = [
# {
# toolbar = true;
# bookmarks = [
# {
# name = "Home Manager";
# url = "https://nixos.wiki/wiki/Home_Manager";
# }
# {
# name = "Nix PR Channel Tracker";
# url = "https://nixpk.gs/pr-tracker.html";
# }
# {
# name = "Chaotic Nix";
# url = "https://www.nyx.chaotic.cx/";
# }
# ];
# }
# {
# name = "wikipedia";
# tags = [ "wiki" ];
# keyword = "wiki";
# url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
# }
# {
# name = "kernel.org";
# url = "https://www.kernel.org";
# }
# {
# name = "Nix sites";
# bookmarks = [
# {
# name = "homepage";
# url = "https://nixos.org/";
# }
# {
# name = "wiki";
# tags = [ "wiki" "nix" ];
# url = "https://nixos.wiki/";
# }
# {
# name = "Nix sites";
# bookmarks = [
# {
# name = "homepage";
# url = "https://nixos.org/";
# }
# {
# name = "wiki";
# url = "https://nixos.wiki/";
# }
# ];
# }
# ];
# }
# ];
};
};
}