Question about Firefox module extension handling

Is it possible to create something like

programs.firefox.policies.ExtensionSettings.normal_installed.myParameter = { url = "$VAR/latest.xpi"; }

So you can just do programs.firefox.policies.ExtensionSettings.normal_installed.myParameter.ublock-origin?

What do you want to do?

Create a command so if I want a plug-in, that’ll be as simple as myParameter.ublock-origin

So ideally I could

myParameter = {

No, it’s not possible. Here is my config.

    ExtensionSettings = builtins.mapAttrs
        (_: v: {
          installation_mode = "normal_installed";
          install_url = "${v}/latest.xpi";
          "{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
          "" = "darkreader";

You need both the id and the name.

1 Like

Can’t you reduce it to ExtensionSettings.<id>.<name> that would develop into

programs.firefox.policies.ExtensionSettings = builtins.mapAttrs
  (_: extension-name: {
    installation_mode = "normal_installed";
    install_url = "${extension-name}/latest.xpi";
    "<extension-id>" = "<extension-name>";


Here is a script to populate automatically IDs on your "" = "<extension-name>"; structure:

set -xv && \
cd && \
git clone
chmod +x firefoxExtensionID/ && \
for i in `grep '  \"\"' /etc/nixos/configuration.nix | cut -d '"' -f 4`
do sudo sed --in-place "s/\"\"\; = \"$i\"/\"$(bash firefoxExtensionID/ $i | grep --invert-match ID\ found)\" = \"$i\"\;/g" /etc/nixos/configuration.nix | grep $i
set +xv

Take care of only --in-place when you’re sure about the result

It’s weird, programs.firefox.policies.ExtensionSettings doesn’t seem to install FireFox and don’t seem to install any extension aswell. Nothing seems downloaded of modified in regard of FireFox/extensions when doing rebuild switch. And even if you get FireFox with nix-shell --packages firefox, FireFox doesn’t open with more extensions than before

But with programs.firefox.enable it works fine

Yes. You need to enable it to enable it. :wink: