{
  lib,
  pkgs,
  scope,
  ...
}:
let
  officialAddon = name: {
    install_url = lib.strings.concatStrings [
      "https://addons.mozilla.org/firefox/downloads/latest/"
      name
      "/latest.xpi"
    ];
    installation_mode = "force_installed";
  };
  lock-false = {
    Value = false;
    Status = "locked";
  };
  lock-true = {
    Value = true;
    Status = "locked";
  };
in
(scope "apps.browser" <| pkgs.firefox)
// scope "programs.firefox" {
  enable = true;

  policies = {
    DisableTelemetry = true;
    DisableFirefoxStudies = true;
    EnableTrackingProtection = {
      Value = true;
      Locked = true;
      Cryptomining = true;
      Fingerprinting = true;
    };
    DisablePocket = true;
    DisableFirefoxAccounts = true;
    DisableAccounts = true;
    DisableFirefoxScreenshots = true;
    DisableAppUpdate = true;
    DisablePrivateBrowsing = true;
    DontCheckDefaultBrowser = true;

    OverrideFirstRunPage = "";
    OverridePostUpdatePage = "";
    DisplayBookmarksToolbar = "newtab"; # alternatives: "always" or "newtab"
    DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on"
    SearchBar = "unified"; # alternative: "separate"

    ExtensionSettings = {
      "*".installation_mode = "blocked"; # blocks all addons except the ones specified below
      "uBlock0@raymondhill.net" = officialAddon "ublock-origin";
      "addon@darkreader.org" = officialAddon "darkreader";
      "vimium-c@gdh1995.cn" = officialAddon "vimium-c";
      "{b86e4813-687a-43e6-ab65-0bde4ab75758}" = officialAddon "localcdn-fork-of-decentraleyes";
      "jid1-5Fs7iTLscUaZBgwr@jetpack" = officialAddon "happy-bonobo-disable-webrtc";
      "{446900e4-71c2-419f-a6a7-df9c091e268b}" = officialAddon "bitwarden-password-mananger";
    };

    Preferences = {
      "extensions.pocket.enabled" = lock-false;
      "extensions.screenshots.disabled" = lock-true;
      "browser.topsites.contile.enabled" = lock-false;
      "browser.formfill.enable" = lock-false;
      "browser.search.suggest.enabled" = lock-false;
      "browser.search.suggest.enabled.private" = lock-false;
      "browser.urlbar.suggest.searches" = lock-false;
      "browser.urlbar.showSearchSuggestionsFirst" = lock-false;
      "browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
      "browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
      "browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
      "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = lock-false;
      "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = lock-false;
      "browser.newtabpage.activity-stream.section.highlights.includeVisited" = lock-false;
      "browser.newtabpage.activity-stream.showSponsored" = lock-false;
      "browser.newtabpage.activity-stream.system.showSponsored" = lock-false;
      "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false;
    };
  };

  # profiles.default = {
  #   id = 0;
  #   name = "Default";
  #   settings = {
  #     "browser.startup.homepage" = "about:blank";
  #     "browser.shell.didSkipDefaultBrowserCheckOnFirstRun" = true;
  #     "browser.policies.applied" = true;
  #     "widget.use-xdg-desktop-portal.file-picker" = 1;
  #     "widget.use-xdg-desktop-portal.mime-handler" = 1;
  #   };
  # };
}
// (scope "apps.browser" <| pkgs.firefox)
# )
