{ pkgs, config, lib, self, ... }: let cfg = config.my.graphical.firefox; in { options.my.graphical.firefox = { enable = lib.mkEnableOption null; }; config = lib.mkIf cfg.enable { programs.firefox = { enable = true; policies = { DisableFirefoxStudies = true; DisablePocket = true; DisableFirefoxAccounts = true; DisableProfileImport = true; DisplayBookmarksToolbar = "never"; NoDefaultBookmarks = true; OfferToSaveLogins = false; DontCheckDefaultBrowser = true; UserMessaging = { ExtensionRecommendations = false; SkipOnboarding = true; }; ExtensionSettings = let mozillaExtensions = { buster-captcha-solver = "{e58d3966-3d76-4cd9-8552-1582fbc800c1}"; clearurls = "{74145f27-f039-47ce-a470-a662b129930a}"; search_by_image = "{2e5ff8c8-32fe-46d0-9fc8-6b8986621f3c}"; styl-us = "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}"; traduzir-paginas-web = "{036a55b4-5e72-4d05-a06c-cba2dfcc134a}"; violentmonkey = "{aecec67f-0d10-4fa7-b7c7-609a2db280cf}"; indie-wiki-buddy = "{cb31ec5d-c49a-4e5a-b240-16c767444f62}"; sponsorblock = "sponsorBlocker@ajay.app"; tabcenter-reborn = "tabcenter-reborn@ariasuni"; ublock-origin = "uBlock0@raymondhill.net"; firefox-color = "FirefoxColor@mozilla.com"; foxyproxy-standard = "foxyproxy@eric.h.jung"; } // lib.optionalAttrs config.my.keepassxc.enable { keepassxc-browser = "keepassxc-browser@keepassxc.org"; }; in builtins.mapAttrs (_: url: { install_url = url; installation_mode = "force_installed"; }) (lib.mapAttrs' (name: id: lib.nameValuePair id "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi" ) mozillaExtensions); }; profiles.errie = { settings = { "browser.aboutConfig.showWarning" = false; "browser.cache.disk.enable" = false; "browser.cache.memory.capacity" = 2000000; "browser.ctrlTab.sortByRecentlyUsed" = false; "browser.newtabpage.activity-stream.feeds.section.topstories" = false; "browser.newtabpage.activity-stream.feeds.topsites" = false; "browser.newtabpage.pinned" = []; "browser.startup.page" = 3; "cookiebanners.service.mode" = 1; "cookiebanners.service.mode.privateBrowsing" = 1; "devtools.selfxss.count" = 100; "media.ffmpeg.vaapi.enabled" = true; "privacy.webrtc.legacyGlobalIndicator" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "ui.key.menuAccessKeyFocuses" = false; "widget.wayland.fractional-scale.enabled" = true; }; search = { default = "DuckDuckGo"; force = true; order = [ "DuckDuckGo" "SearXNG" "Google" ]; engines = { "SearXNG" = { definedAliases = [ "@searxng" ]; icon = "${self}/assets/searxng.svg"; urls = [{ template = "https://etsi.me/search"; params = [{ name = "q"; value = "{searchTerms}"; }]; }]; }; "Nix Packages" = { definedAliases = [ "@pkgs" "@nixpkgs" ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; urls = [{ template = "https://search.nixos.org/packages"; params = [ { name = "channel"; value = "unstable"; } { name = "type"; value = "packages"; } { name = "query"; value = "{searchTerms}"; } ]; }]; }; "Hoogle" = { definedAliases = [ "@hoogle" ]; urls = [{ template = "https://hoogle.haskell.org/"; params = [{ name = "hoogle"; value = "{searchTerms}"; }]; }]; }; } // lib.genAttrs [ "Bing" "Amazon.com" "eBay" ] (_: {metaData.hidden = true;}); }; userChrome = let verticalTabs = pkgs.fetchzip { url = "https://codeberg.org/ranmaru22/firefox-vertical-tabs/archive/v6.5.tar.gz"; hash = "sha256-DHI8QFr4z00tlS8SlWrrNymP6pRQ55YHq6ZegDx5iYk="; }; in '' @import url("file://${verticalTabs}/userChrome.css"); /* Hide the close button */ .titlebar-buttonbox-container, .titlebar-spacer[type="post-tabs"] { display: none !important; } /* Remove padding on the right */ #nav-bar { --uc-navbar-padding: 0; } ''; }; }; }; }