{ config, pkgs, ... }:

{
  programs.firefox = {
    enable = true;

    policies = {
      AutofillAddressEnabled = false;
      AutofillCreditCardEnabled = false;
      BlockAboutAddons = true;
      BlockAboutConfig = true;
      BlockAboutProfiles = true;
      Bookmarks = [
        {
          Placement = "toolbar";
          Title = "NixOS Search";
          URL = "https://search.nixos.org";
        }
        {
          Placement = "toolbar";
          Title = "NixOS Wiki";
          URL = "https://wiki.nixos.org";
        }
        {
          Placement = "toolbar";
          Title = "c-base";
          URL = "https://c-base.org";
        }
        {
          Placement = "toolbar";
          Title = "c-base Wiki";
          URL = "https://wiki.c-base.org";
        }
      ];
      Cookies = {
        Behavior = "accept";
        BehaviorPrivateBrowsing = "reject";
      };
      DisableAccounts = true;
      DisableAppUpdate = true;
      DisableBuiltinPDFViewer = true;
      DisableFeedbackCommands = true;
      DisableFirefoxScreenshots = true;
      DisableFirefoxStudies = true;
      DisableForgetButton = true;
      DisableFormHistory = true;
      DisablePasswordReveal = true;
      DisableProfileImport = true;
      DisableProfileRefresh = true;
      DisableSetDesktopBackground = true;
      DisableTelemetry = true;
      EnableTrackingProtection = {
        BaselineExceptions = true;
        Category = "standard";
        ConvenienceExceptions = true;
        Cryptomining = true;
        EmailTracking = true;
        Fingerprinting = true;
        SuspectedFingerprinting = true;
        Value = true;
      };
      ExtensionUpdate = false;
      FirefoxSuggest = {
        ImproveSuggest = false;
        SponsoredSuggestions = false;
        WebSuggestions = true;
      };
      HardwareAcceleration = false;
      NewTabPage = true;
      PasswordManagerEnabled = false;
      PictureInPicture = {
        Enabled = true;
      };
      Preferences = {
        browser.fixup.dns_first_for_single_words = {
          Status = "locked";
          Type = "boolean";
          Value = true;
        };
        browser.search.update = {
          Status = "locked";
          Type = "boolean";
          Value = true;
        };
        extensions.getAddons.showPane = {
          Status = "locked";
          Type = "boolean";
          Value = false;
        };
        media.gmp-gmpopenh264.enabled = {
          Status = "locked";
          Type = "boolean";
          Value = true;
        };
        network.IDN_show_punycode = {
          Status = "locked";
          Type = "boolean";
          Value = true;
        };
        network.dns.disableIPv6 = {
          Status = "locked";
          Type = "boolean";
          Value = false;
        };
      };
      PrintingEnabled = true;
      PrivateBrowsingModeAvailability = 0;
      SanitizeOnShutdown = {
        Cache = true;
        Cookies = false;
        FormData = false;
        History = false;
        Sessions = false;
        SiteSettings = false;
      };
      TranslateEnabled = false;
    };
  };
}
