Skip to content

Firefox configuration via policies.json for NixOS Setup? #905

@Kreyren

Description

@Kreyren

Referencing: https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265/26?u=kryren

NixOS is a linux/bsd distribution that is on my end stateless meaning that the OS reinstalls itself on each reboot to provide bit-by-bit reproducible OS on each reboot with any changes made to the filesystem that are not explicitly set in the configuration or allowlisted (e.g. personal files) are removed.

For Firefox i am trying to declare a libredirect configuration so that when i open firefox it would have the extension configured to my liking without me having to reconfigure libredirect after each reboot.

On Firefox this is often done through policies.json (https://support.mozilla.org/en-US/kb/customizing-firefox-using-policiesjson) such as ublock-origin:
https://github.com/Kreyren/nixos-config/blob/bd4765eb802a0371de7291980ce999ccff59d619/nixos/users/kreyren/home/modules/web-browsers/firefox/firefox.nix#L116-L148

For that i found the config.json file:
https://github.com/libredirect/browser_extension/blob/b3457faf1bdcca0b17872e30b379a7ae55bc8fd0/src/config.json

But trying to replicate it's configuration in policies.json doesn't work:
https://github.com/Kreyren/nixos-config/blob/bd4765eb802a0371de7291980ce999ccff59d619/nixos/users/kreyren/home/modules/web-browsers/firefox/firefox.nix#L114

The generated policy.json:

{
  "policies": {
    ...
    "3rdparty": {
      "Extensions": {
        "7esoorv3@alefvanoon.anonaddy.me": {
          "services": {
            "youtube": {
              "options": {
                "enabled": true
              }
            }
          }
        },
        "uBlock0@raymondhill.net": {
          "adminSettings": {
            "selectedFilterLists": [
              "CZE-0",
              "adguard-generic",
              "adguard-annoyance",
              "adguard-social",
              "adguard-spyware-url",
              "easylist",
              "easyprivacy",
              "https://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt",
              "plowe-0",
              "ublock-abuse",
              "ublock-badware",
              "ublock-filters",
              "ublock-privacy",
              "ublock-quick-fixes",
              "ublock-unbreak",
              "urlhaus-1"
            ],
            "userSettings": {
              "cloudStorageEnabled": false,
              "externalLists": "https://filters.adtidy.org/extension/ublock/filters/3.txt\nhttps://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt",
              "importedLists": [
                "https://filters.adtidy.org/extension/ublock/filters/3.txt",
                "https://github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt"
              ],
              "uiAccentCustom": true,
              "uiAccentCustom0": "#8300ff",
              "uiTheme": "dark"
            }
          }
        }
      }
    },
    ...
    "ExtensionSettings": {
      "*": {
        "blocked_install_message": "FUCKING FORGET IT!",
        "installation_mode": "blocked"
      },
      "7esoorv3@alefvanoon.anonaddy.me": {
        "install_url": "file:////nix/store/vl28jnn71crhknpizd64q74spryp3ga2-libredirect-2.8.2/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/7esoorv3@alefvanoon.anonaddy.me.xpi",
        "installation_mode": "force_installed"
      }
    },
    "ExtensionUpdate": false,
    ...
}

Do you know why that doesn't work or if it's extension-related issue could you adjust libredirect so that it can be configured through policies.json?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions