{ pkgs, inputs,... }:
{
  imports = [
    inputs.zen-browser.homeModules.beta
  ];
  programs.zen-browser = {
    enable = true;

    profiles = {
      default = {
        # bookmarks, extensions, search engines...
	id = 0;
	isDefault = true;
	name = "default";
	search = {
	  force = true;
	  default = "Kagi";
	  engines = {
	  "Kagi" = {
            urls = [{ template = "https://kagi.com/search?q={searchTerms}"; }];
            icon = "https://kagi.com/favicon.ico";
            updateInterval = 24 * 60 * 60 * 1000; # every day
            definedAliases = [ "@kagi" ];
            };
	  };
	};
      };
    };
    policies = let
      mkExtensionSettings = builtins.mapAttrs (_: pluginId: {
      install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
      installation_mode = "force_installed";
      });
    in {
      ExtensionSettings = mkExtensionSettings {
        "uBlock0@raymondhill.net" = "ublock-origin";
	"search@kagi.com" = "kagi-search-for-firefox";
	#"adnauseam@rednoise.org" = "adnauseam";
	"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
	"{7be2ba16-0f1e-4d93-9ebc-5164397477a9}" = "videospeed";
      };
      DisableTelemetry = true;
    };
  };
}
