mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-14 04:51:08 +01:00
firefox: add support for configuring extensions
This commit refactors programs.firefox.profiles.<name>.extensions in order to support both installation of extensions (addons) and their configuration. It does this by setting the `extensions.webextensions.ExtensionStorageIDB.enabled` user_pref to false. When this preference is set to false, support for storing extension settings in sqlite databases, also known as IndexedDB or IDB, is reverted back to the JSON format present in firefox versions prior to version 63, as seen here: https://blog.mozilla.org/addons/2018/08/03/new-backend-for-storage-local-api/ IndexedDB was made the default due to performance improvements, but had the consequence of removing any possibility of declarative extension configuration without the assistance of firefox's policy system. The policy system is supported by a small amount of extensions, such as uBlock Origin, but has to be explicitly supported. Even when supported, it provides significantly less granular control when compared to the JSON storage format.
This commit is contained in:
parent
3a0cf8f1aa
commit
27ffa35178
4 changed files with 190 additions and 78 deletions
|
|
@ -0,0 +1,31 @@
|
|||
modulePath:
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = mkIf config.test.enableBig (setAttrByPath modulePath {
|
||||
enable = true;
|
||||
profiles.extensions = {
|
||||
extensions.settings."uBlock0@raymondhill.net".settings = {
|
||||
selectedFilterLists = [
|
||||
"ublock-filters"
|
||||
"ublock-badware"
|
||||
"ublock-privacy"
|
||||
"ublock-unbreak"
|
||||
"ublock-quick-fixes"
|
||||
];
|
||||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/${cfg.configPath}/extensions/uBlock0@raymondhill.net/storage.js \
|
||||
${./expected-storage.js}
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"selectedFilterLists":["ublock-filters","ublock-badware","ublock-privacy","ublock-unbreak","ublock-quick-fixes"]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue