nix/modules/stuff/firefox.nix
2024-10-16 11:40:24 +02:00

197 lines
9 KiB
Nix

{ lib, pkgs, config, ... }: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.chuj.stuff.firefox;
user = config.chuj.system.user;
in {
options.chuj.stuff.firefox = {
enable = mkEnableOption "firefox";
};
config = mkIf cfg.enable {
home-manager.users.${user}.programs.firefox = {
enable = true;
package = pkgs.firefox-bin;
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "always";
DisplayMenuBar = "default-off";
SearchBar = "unified";
DefaultDownloadDirectory = config.home-manager.users.${user}.xdg.userDirs.download;
ExtensionSettings = {
# ublock origin
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "normal_installed";
};
# youtube redux
"{2d4c0962-e9ff-4cad-8039-9a8b80d9b8b6}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4224361/latest.xpi";
installation_mode = "normal_installed";
};
# sponsorblock
"sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4251917/latest.xpi";
installation_mode = "normal_installed";
};
# legacy wikipedia layout
"{484f3bc9-b13b-4498-8ea6-124c199c5ca8}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4100662/latest.xpi";
installation_mode = "normal_installed";
};
};
};
profiles.${user} = {
id = 0;
isDefault = true;
search = {
default = "envs.net - SearXNG";
force = true;
engines = {
"envs.net - SearXNG" = {
urls = [ { template = "https://searx.envs.net/searxng/search?q={searchTerms}"; } ];
icon = "https://envs.net/favicon.ico";
iconUpdateURL = "https://envs.net/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@sx" ];
};
# searx sometimes sucks
"Google".metaData.alias = "@g";
"Wikipedia (en)".metaData.alias = "@w";
"Wikipedia (pl)" = {
urls = [ { template = "https://pl.wikipedia.org/w/index.php?search={searchTerms}"; } ];
icon = "https://pl.wikipedia.org/static/favicon/wikipedia.ico";
iconUpdateURL = "https://pl.wikipedia.org/static/favicon/wikipedia.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@wpl" ];
};
"Nix Packages" = {
urls = [ { template = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}"; } ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"Nix Options" = {
urls = [ { template = "https://search.nixos.org/options?channel=unstable&query={searchTerms}"; } ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"Home Manger" = {
urls = [ { template = "https://home-manager-options.extranix.com/?release=master&query={searchTerms}"; } ];
icon = "https://home-manager-options.extranix.com/images/favicon.png";
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@hm" ];
};
"Arch Wiki" = {
urls = [ { template = "https://wiki.archlinux.org/index.php?search={searchTerms}"; } ];
icon = "https://wiki.archlinux.org/favicon.ico";
iconUpdateURL = "https://wiki.archlinux.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@aw" ];
};
"NixOS Wiki" = {
urls = [ { template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; } ];
icon = "https://nixos.wiki/favicon.png";
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nw" ];
};
"Noogle" = {
urls = [ { template = "https://noogle.dev/q?term={searchTerms}"; } ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@ng" ];
};
"Wolfram Alpha" = {
urls = [ { template = "https://www.wolframalpha.com/input?i={searchTerms}"; } ];
icon = "https://www.wolframalpha.com/_next/static/images/favicon_1zbE9hjk.ico";
iconUpdateURL = "https://www.wolframalpha.com/_next/static/images/favicon_1zbE9hjk.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@wa" ];
};
# the rest can fuck off
"Bing".metaData.hidden = true;
"DuckDuckGo".metaData.hidden = true;
"eBay".metaData.hidden = true; # ??? who up ebaying they firegfox
};
};
settings = {
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"services.sync.prefs.sync.extensions.activeThemeID" = "false";
"middlemouse.paste" = "false";
"browser.download.dir" = config.home-manager.users.${user}.xdg.userDirs.download;
# https://git.jacekpoz.pl/jacekpoz/niksos/src/branch/master/modules/gui/firefox.nix#L405
# but modified (a bit)
"browser.aboutConfig.showWarning" = false;
"browser.startup.page" = 3;
"browser.startup.homepage" = "about:home";
"browser.newtabpage.enabled" = true;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.default.sites" = "";
"extensions.getAddons.showPane" = false;
"extensions.htmlaboutaddons.recommendations.enabled" = false;
"browser.discovery.enabled" = false;
"extensions.unifiedExtensions.enabled" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.server" = "data:,";
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.coverage.opt-out" = true;
"toolkit.coverage.endpoint.base" = "";
"browser.ping-centre.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"app.shield.optoutstudies.enabled" = false;
"app.normandy.enabled" = false;
"app.normandy.api_url" = "";
"breakpad.reportURL" = "";
"browser.tabs.crashReporting.sendReport" = false;
"browser.crashReports.unsubmittedCheck.enabled" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"captivedetect.canonicalURL" = "";
"network.captive-portal-service.enabled" = false;
"network.connectivity-service.enabled" = false;
"browser.safebrowsing.malware.enabled" = false;
"browser.safebrowsing.phishing.enabled" = false;
"browser.safebrowsing.downloads.enabled" = false;
"browser.safebrowsing.downloads.remote.enabled" = false;
"browser.safebrowsing.downloads.remote.url" = "";
"browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false;
"browser.safebrowsing.downloads.remote.block_uncommon" = false;
"browser.safebrowsing.allowOverride" = false;
"privacy.resistFingerprinting.block_mozAddonManager" = true;
"gfx.webrender.all" = true;
# "media.ffmpeg.vaapi.enabled" = true;
# "identity.sync.tokenserver.uri" = "https://ffsync.jacekpoz.pl/1.0/sync/1.5";
"dom.private-attribution.submission.enabled" = false;
};
};
};
};
}