bphd
November 6, 2023, 12:45pm
1
Is it possible to create something like
programs.firefox.policies.ExtensionSettings.normal_installed.myParameter = { url = "https://addons.mozilla.org/firefox/downloads/latest/$VAR/latest.xpi"; }
So you can just do programs.firefox.policies.ExtensionSettings.normal_installed.myParameter.ublock-origin
?
bphd
November 8, 2023, 9:33am
3
Create a command so if I want a plug-in, that’ll be as simple as myParameter.ublock-origin
So ideally I could
myParameter = {
ublock-origin
dark-reader
}
vccs
November 8, 2023, 10:53am
5
No, it’s not possible. Here is my config.
ExtensionSettings = builtins.mapAttrs
(_: v: {
installation_mode = "normal_installed";
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${v}/latest.xpi";
})
{
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"addon@darkreader.org" = "darkreader";
};
You need both the id and the name.
1 Like
bphd
November 8, 2023, 11:58am
6
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 = "https://addons.mozilla.org/firefox/downloads/latest/${extension-name}/latest.xpi";
})
{
"<extension-id>" = "<extension-name>";
};
?
bphd
November 8, 2023, 2:09pm
7
Here is a script to populate automatically IDs on your "" = "<extension-name>";
structure:
set -xv && \
cd && \
git clone https://github.com/ax-mz/firefoxExtensionID.git
chmod +x firefoxExtensionID/fei.sh && \
for i in `grep ' \"\"' /etc/nixos/configuration.nix | cut -d '"' -f 4`
do sudo sed --in-place "s/\"\"\; = \"$i\"/\"$(bash firefoxExtensionID/fei.sh $i | grep --invert-match ID\ found)\" = \"$i\"\;/g" /etc/nixos/configuration.nix | grep $i
done
set +xv
Take care of only --in-place
when you’re sure about the result
bphd
November 8, 2023, 2:32pm
8
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
vccs
November 8, 2023, 6:15pm
9
Yes. You need to enable it to enable it.