system/modules/nixos/programs/browsers/policies.nix

111 lines
3.5 KiB
Nix
Raw Permalink Normal View History

2024-04-16 02:51:46 +03:00
{ withKeePassXcAddon ? false
, withPassffAddon ? false
, withRedirectorAddon ? false
, withSidebarTabsAddon ? false
2024-04-18 18:18:53 +03:00
, withAllSearchEngines ? false
, firefoxAddons ? { }
2024-04-16 02:51:46 +03:00
, lib
, writeText
, ...
}:
let
firefoxAddonXpiPath = addon:
"${addon}/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/${addon.addonId}.xpi";
in
# See: https://mozilla.github.io/policy-templates/
writeText "policies.json" (builtins.toJSON {
policies = {
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DisableAppUpdate = true;
DisableSystemAddonUpdate = true;
DisableFirefoxStudies = true;
DisableTelemetry = true;
DisableFeedbackCommands = true;
SearchBar = "unified";
SearchSuggestEnabled = false;
SearchEngines = {
Add = [
{
Alias = "sx";
Name = "SearXNG";
Description = "SearXNG a privacy-respecting, open metasearch engine";
IconURL = "https://search.sapti.me/static/themes/simple/img/favicon.png";
URLTemplate = "https://search.sapti.me/search?q={searchTerms}";
}
2024-04-18 18:18:53 +03:00
] ++ lib.optionals withAllSearchEngines [
2024-04-16 02:51:46 +03:00
{
Alias = "np";
Name = "NixOS Packages";
Description = "Search NixOS packages by name or description.";
IconURL = "https://nixos.org/favicon.png";
URLTemplate = "https://search.nixos.org/packages?query={searchTerms}";
}
{
Alias = "no";
Name = "NixOS Options";
Description = "Search NixOS options by name or description.";
IconURL = "https://nixos.org/favicon.png";
URLTemplate = "https://search.nixos.org/options?query={searchTerms}";
}
2024-04-18 18:18:53 +03:00
{
Alias = "ng";
Name = "Noogle";
Description = "Search for nix functions by name.";
IconURL = "https://noogle.dev/favicon.png";
URLTemplate = "https://noogle.dev/q?term={searchTerms}";
}
{
Alias = "hg";
Name = "Hoogle";
Description = ''
Hoogle is a Haskell API search engine, which allows you to
search many standard Haskell libraries by either function name,
or by approximate type signature.'';
URLTemplate = "https://hoogle.haskell.org/?hoogle={searchTerms}";
IconURL = "https://hoogle.haskell.org/favicon64.png";
}
2024-04-16 02:51:46 +03:00
];
Default = "SearXNG";
Remove = [
"Google"
"Bing"
"Amazon.com"
"eBay"
"Twitter"
"YouTube"
"Yahoo"
];
};
FirefoxSuggest = {
WebSuggestions = false;
SponsoredSuggestions = false;
ImproveSuggest = false;
Locked = true;
};
Preferences = {
"layout.spellcheckDefault" = {
Value = 0;
Status = "locked";
};
};
Extensions = {
Install =
lib.optional withKeePassXcAddon (firefoxAddonXpiPath firefoxAddons.keepassxc-browser)
++ lib.optional withPassffAddon (firefoxAddonXpiPath firefoxAddons.passff)
++ lib.optional withRedirectorAddon (firefoxAddonXpiPath firefoxAddons.redirector)
++ lib.optional withSidebarTabsAddon (firefoxAddonXpiPath firefoxAddons.sidebartabs);
Uninstall = [
"google@search.mozilla.org"
"bing@search.mozilla.org"
"amazondotcom@search.mozilla.org"
"ebay@search.mozilla.org"
"twitter@search.mozilla.org"
"youtube@search.mozilla.org"
"yahoo@search.mozilla.org"
];
};
};
})