{ config, lib, pkgs, ... }: let cfg = config.hm.soft.browser; in { options.hm.soft.browser = { librewolf.enable = lib.mkEnableOption "LibreWolf browser"; brave.enable = lib.mkEnableOption "Brave browser"; }; config = lib.mkMerge [ (lib.mkIf cfg.librewolf.enable { programs.librewolf = { enable = true; settings = { "toolkit.legacyUserProfileCustomizations.stylesheets" = true; }; profiles = { main = { id = 0; name = "main"; isDefault = true; search = { force = true; engines = { "SearXNG" = { urls = [ { template = "https://sxng.violets-purgatory.dev/search?q={searchTerms}"; } ]; definedAliases = [ "@s" ]; }; "NixOS Packages" = { urls = [ { template = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}"; } ]; icon = ""; definedAliases = [ "@np" ]; }; "NixOS Options" = { urls = [ { template = "https://search.nixos.org/options?channel=unstable&query={searchTerms}"; } ]; icon = ""; definedAliases = [ "@no" ]; }; "Home Manager Options" = { urls = [ { template = "https://home-manager-options.extranix.com/?query={searchTerms}&release=master"; } ]; definedAliases = [ "@hm" ]; }; }; }; extensions = { force = true; packages = with pkgs.nur.repos.rycee.firefox-addons; [ ublock-origin sidebery bitwarden buster-captcha-solver sponsorblock dearrow darkreader violentmonkey i-dont-care-about-cookies keepassxc-browser noscript privacy-settings protondb-for-steam steam-database terms-of-service-didnt-read unpaywall ]; }; settings = { "identity.fxaccounts.enabled" = true; # --- Privacy & Fingerprinting --- "privacy.resistFingerprinting" = true; "privacy.fingerprintingProtection" = true; "privacy.query_stripping.enabled" = true; "privacy.query_stripping.enabled.pbmode" = true; "privacy.trackingprotection.enabled" = true; "privacy.trackingprotection.socialtracking.enabled" = true; "privacy.trackingprotection.emailtracking.enabled" = true; "privacy.bounceTrackingProtection.mode" = 1; "privacy.annotate_channels.strict_list.enabled" = true; "privacy.clearOnShutdown_v2.formdata" = true; # --- Data Collection & Form Security --- "dom.forms.autocomplete.formautofill" = false; "signon.management.page.breach-alerts.enabled" = false; "browser.translations.enable" = false; "browser.region.update.enabled" = false; # --- Search & URL Bar --- "browser.urlbar.shortcuts.bookmarks" = false; "browser.urlbar.shortcuts.history" = false; "browser.urlbar.shortcuts.tabs" = false; "browser.urlbar.shortcuts.actions" = false; "browser.urlbar.showSearchTerms.enabled" = false; # --- Networking & Performance --- "network.proxy.type" = 0; "network.prefetch-next" = false; "network.predictor.enabled" = false; "network.http.speculative-parallel-limit" = 0; "network.early-hints.preconnect.max_connections" = 0; "network.connectivity-service.enabled" = false; "network.captive-portal-service.enabled" = false; "security.tls.enable_0rtt_data" = false; # --- Interface & De-clutter --- "browser.startup.page" = 3; "browser.startup.homepage" = "chrome://browser/content/blanktab.html"; "browser.newtabpage.enabled" = false; "browser.newtabpage.activity-stream.showSearch" = false; "browser.newtabpage.activity-stream.showSponsoredCheckboxes" = false; "browser.bookmarks.restore_default_bookmarks" = false; "media.hardwaremediakeys.enabled" = false; "media.videocontrols.picture-in-picture.video-toggle.enabled" = false; "layout.spellcheckDefault" = 0; # --- Safe Browsing (Privacy Trade-off) --- "browser.safebrowsing.downloads.remote.enabled" = false; "browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false; "browser.safebrowsing.downloads.remote.block_uncommon" = false; }; userChrome = '' #TabsToolbar { visibility: collapse !important; } #sidebar-header { display: none !important; } #toolbar-menubar { display: none !important; } ''; }; privacy = { id = 1; name = "privacy"; settings = { "media.peerconnection.enabled" = false; "network.proxy.type" = 1; "network.proxy.http" = "127.0.0.1"; "network.proxy.http_port" = 4444; "network.proxy.ssl" = "127.0.0.1"; "network.proxy.ssl_port" = 4444; "network.proxy.no_proxies_on" = "localhost, 127.0.0.1"; "network.http.proxy.pipelining" = true; "network.proxy.share_proxy_settings" = true; "network.prefetch-next" = false; "network.dns.disablePrefetch" = true; }; userChrome = '' #TabsToolbar { visibility: collapse !important; } #sidebar-header { display: none !important; } #toolbar-menubar { display: none !important; } ''; }; }; }; }) (lib.mkIf cfg.brave.enable { home.packages = [ pkgs.brave ]; }) ]; }