From ae7430884dc62c7bcd1583e7539e70247b3999cb Mon Sep 17 00:00:00 2001 From: Elec3137 Date: Wed, 8 Apr 2026 13:12:05 -0700 Subject: [PATCH] feat(defaults/browsers): add to firefox --- defaults/browsers.nix | 48 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/defaults/browsers.nix b/defaults/browsers.nix index 56b3d17..d146362 100644 --- a/defaults/browsers.nix +++ b/defaults/browsers.nix @@ -16,17 +16,27 @@ in config = lib.mkIf cfg.enable { programs.firefox = lib.mkDefault { policies = { - ExtensionSettings = { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "normal_installed"; - }; - }; + ExtensionSettings = + let + # source: https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/17 + extension = shortId: uuid: { + name = uuid; + value = { + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + installation_mode = "normal_installed"; + }; + }; + in + builtins.listToAttrs [ + (extension "ublock-origin" "uBlock0@raymondhill.net") + (extension "black21" "{9b84b6b4-07c4-4b4b-ba21-394d86f6e9ee}") + ]; + Preferences = { "browser.newtabpage.activity-stream.feeds.wallpaperfeed".Value = false; "browser.newtabpage.activity-stream.feeds.weatherfeed".Value = false; - # from https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265 + # source: https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265 "browser.newtabpage.activity-stream.feeds.section.topstories".Value = false; "browser.newtabpage.activity-stream.feeds.snippets".Value = false; "browser.newtabpage.activity-stream.section.highlights.includePocket".Value = false; @@ -36,6 +46,30 @@ in "browser.newtabpage.activity-stream.showSponsored".Value = false; "browser.newtabpage.activity-stream.system.showSponsored".Value = false; "browser.newtabpage.activity-stream.showSponsoredTopSites".Value = false; + + "browser.newtabpage.activity-stream.showSearch".Value = false; + "browser.newtabpage.activity-stream.feeds.topsites".Value = false; + "browser.newtabpage.activity-stream.showWeather".Value = false; + }; + + SearchEngines = { + Add = [ + # source: https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/33 + { + Alias = "@np"; + IconURL = "https://nixos.org/favicon.png"; + Method = "GET"; + Name = "NixOS Packages"; + URLTemplate = "https://search.nixos.org/packages?from=0&size=200&sort=relevance&type=packages&query={searchTerms}"; + } + { + Alias = "@no"; + IconURL = "https://nixos.org/favicon.png"; + Method = "GET"; + Name = "NixOS Options"; + URLTemplate = "https://search.nixos.org/options?from=0&size=200&sort=relevance&type=packages&query={searchTerms}"; + } + ]; }; }; };