{pkgs, inputs, ...}:
{
  programs.firefox = {
    ## Enable the Firefox web browser
    enable = true;
    ## Global preferences
    policies = {
      BlockAboutConfig = true;
      DefaultDownloadDirectory = "\${home}/Downloads";
      ExtensionSettings = with builtins;
        let extension = shortId: uuid: {
          name = uuid;
          value = {
            install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
            installation_mode = "normal_installed";
          };
        };
        in listToAttrs [
          (extension "ublock-origin" "uBlock0@raymondhill.net")
          (extension "tabliss" "extension@tabliss.io")
          (extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}")
          (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org")
          (extension "ghostery" "firefox@ghostery.com")
        ];
    };

    ## Per-profile preferences
    profiles.default = {
      search = {
        force = true;
        default = "ddg";
        privateDefault = "ddg";
        order = ["ddg" "google"];
      };
      settings = {
        "browser.startup.homepage" = "about:home";

        # Disable irritating first-run stuff
        "browser.disableResetPrompt" = true;
        "browser.download.panel.shown" = true;
        "browser.feeds.showFirstRunUI" = false;
        "browser.messaging-system.whatsNewPanel.enabled" = false;
        "browser.rights.3.shown" = true;
        "browser.shell.checkDefaultBrowser" = false;
        "browser.shell.defaultBrowserCheckCount" = 1;
        "browser.startup.homepage_override.mstone" = "ignore";
        "browser.uitour.enabled" = false;
        "startup.homepage_override_url" = "";
        "trailhead.firstrun.didSeeAboutWelcome" = true;
        "browser.bookmarks.restore_default_bookmarks" = false;
        "browser.bookmarks.addedImportButton" = true;

        # Disable "save password" prompt
        "signon.rememberSignons" = false;

        # Harden
        "privacy.trackingprotection.enabled" = true;
        "dom.security.https_only_mode" = true;

        # Disable Pocket
        "extensions.pocket.enabled" = false;

        # Disable telemetry
        "toolkit.telemetry.enabled" = false;

        # Remove bookmarks toolbar
        "browser.toolbars.bookmarks.visibility" = "never";

        # Restore session on startup
        "browser.startup.page" = 3;

        # Automatically enable extensions
        "extensions.autoDisableScopes" = 0;


      };

    };
  };

  home.packages = with pkgs; [
    inputs.zen-browser.packages."${system}".default

    # inputs.zen-browser.packages."${system}".default.override {
    #   policies = {
    #     DisableAppUpdate = true;
    #     DisableTelemetry = true;

    #     OfferToSaveLogins = false;
    #     AutofillAddressEnabled = true;
    #     AutofillCreditCardEnabled = false;
    #     # BlockAboutConfig = true;

    #     DefaultDownloadDirectory = "\${home}/Downloads";

    #     ExtensionSettings = with builtins;
    #       let extension = shortId: uuid: {
    #         name = uuid;
    #         value = {
    #           install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
    #           installation_mode = "normal_installed";
    #         };
    #       };
    #       in listToAttrs [
    #         (extension "ublock-origin" "uBlock0@raymondhill.net")
    #         (extension "ghostery" "firefox@ghostery.com")
    #         (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org")
    #         (extension "morphine" "{b252db54-e4f6-440f-914a-1f017a3a390d}")
    #       ];
    #   };
    # }

  ];
  # programs.zen-browser = {
  #   enable = true;

  #   policies = {
  #     DisableAppUpdate = true;
  #     DisableTelemetry = true;

  #     OfferToSaveLogins = false;
  #     AutofillAddressEnabled = true;
  #     AutofillCreditCardEnabled = false;
  #     # BlockAboutConfig = true;

  #     DefaultDownloadDirectory = "\${home}/Downloads";

  #     ExtensionSettings = with builtins;
  #       let extension = shortId: uuid: {
  #         name = uuid;
  #         value = {
  #           install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
  #           installation_mode = "normal_installed";
  #         };
  #       };
  #       in listToAttrs [
  #         (extension "ublock-origin" "uBlock0@raymondhill.net")
  #         (extension "ghostery" "firefox@ghostery.com")
  #         (extension "keepassxc-browser" "keepassxc-browser@keepassxc.org")
  #         (extension "morphine" "{b252db54-e4f6-440f-914a-1f017a3a390d}")
  #       ];
  #   };
  # };
}
