From c5c7082b46468fdee85ebeffa7979c0469b00c73 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Tue, 29 Oct 2024 12:16:00 +0300 Subject: [PATCH] Firefox: Rewrite extensions to match bookmark & search engines format. --- home/program/firefox/default.nix | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/home/program/firefox/default.nix b/home/program/firefox/default.nix index 42597e1d..1b719274 100644 --- a/home/program/firefox/default.nix +++ b/home/program/firefox/default.nix @@ -29,19 +29,19 @@ let (mkSearchEngine "so" "Stack Overflow" "https://stackoverflow.com/search?tab=votes&q={searchTerms}") ]; - extensions = { - "addon@darkreader.org" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi"; - "cliget@zaidabdulla.com" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/cliget/latest.xpi"; - "foxyproxy@eric.h.jung" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi"; - "uBlock0@raymondhill.net" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - "{446900e4-71c2-419f-a6a7-df9c091e268b}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; - "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/user-agent-string-switcher/latest.xpi"; - "{d7742d87-e61d-4b78-b8a1-b469842139fa}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi"; - "{e7625f06-e252-479d-ac7a-db68aeaff2cb}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/togglefonts/latest.xpi"; + extensions = [ + (mkExtension "addon@darkreader.org" "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi") + (mkExtension "cliget@zaidabdulla.com" "https://addons.mozilla.org/firefox/downloads/latest/cliget/latest.xpi") + (mkExtension "foxyproxy@eric.h.jung" "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi") + (mkExtension "uBlock0@raymondhill.net" "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi") + (mkExtension "{446900e4-71c2-419f-a6a7-df9c091e268b}" "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi") + (mkExtension "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" "https://addons.mozilla.org/firefox/downloads/latest/user-agent-string-switcher/latest.xpi") + (mkExtension "{d7742d87-e61d-4b78-b8a1-b469842139fa}" "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi") + (mkExtension "{e7625f06-e252-479d-ac7a-db68aeaff2cb}" "https://addons.mozilla.org/firefox/downloads/latest/togglefonts/latest.xpi") # NOTE: This extension is helpful to find the required parameters for this config. # Or find them yourself inside the `about:support`. - # "queryamoid@kaply.com" = mkExtension "https://github.com/mkaply/queryamoid/releases/download/v0.1/query_amo_addon_id-0.1-fx.xpi"; - }; + # (mkExtension "queryamoid@kaply.com" "https://github.com/mkaply/queryamoid/releases/download/v0.1/query_amo_addon_id-0.1-fx.xpi") + ]; extraConfig = '' // Bookmarks. @@ -141,9 +141,11 @@ let } ''; - mkExtension = install_url: { - inherit install_url; - installation_mode = "force_installed"; + mkExtension = id: install_url: { + ${id} = { + inherit install_url; + installation_mode = "force_installed"; + }; }; mkBookmark = name: url: { inherit name url; }; @@ -170,7 +172,7 @@ in install_sources = [ "*" ]; installation_mode = "blocked"; }; - } // extensions; + } // builtins.foldl' (acc: ext: acc // ext) { } extensions; # NOTE: `firefox-esr` edition is required to change search engines. SearchEngines = { Add = searchEngines;