feat(desktop/firefox): add extension support to profiles

This commit is contained in:
Mohammad Rafiq 2025-06-13 21:30:28 +08:00
parent 02c356494a
commit fba8f1bfdd
No known key found for this signature in database

View file

@ -1,10 +1,31 @@
{ osConfig, lib, ... }: {
osConfig,
lib,
inputs,
system,
...
}:
let let
inherit (builtins) map listToAttrs; inherit (builtins) map listToAttrs;
inherit (lib) mkIf;
inherit (lib.lists) findFirstIndex; inherit (lib.lists) findFirstIndex;
inherit (inputs.nur.legacyPackages.${system}.repos.rycee) firefox-addons;
cfg = osConfig.desktop.browser.firefox; cfg = osConfig.desktop.browser.firefox;
profileCfg = id: { profileCfg = id: {
inherit id; inherit id;
#TODO: move this into an option?
settings = {
"extensions.autoDisableScopes" = 0; # Auto enable extensions
};
extensions = {
force = true;
packages = with firefox-addons; [
darkreader
gesturefy
sponsorblock
ublock-origin
];
};
}; };
profiles = listToAttrs ( profiles = listToAttrs (
map (name: { map (name: {
@ -16,7 +37,7 @@ let
); );
in in
{ {
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ]; home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
home.sessionVariables.BROWSER = "firefox"; home.sessionVariables.BROWSER = "firefox";
programs.firefox = { programs.firefox = {
@ -25,6 +46,7 @@ in
}; };
stylix.targets.firefox = { stylix.targets.firefox = {
profileNames = cfg.syncedProfiles; profileNames = cfg.syncedProfiles;
colorTheme.enable = true;
}; };
}; };
} }