firefox: migrate extraPolicies to overrides.cfg

this fixes that the bookmarks policy in extraPolicies was breaking my bookmarks import
This commit is contained in:
2024-09-02 15:14:20 +00:00
parent 98c62f66dd
commit 3212664f37

View File

@@ -44,58 +44,59 @@ let
nixExtensions = concatMap (ext: optional ext.enable ext.package) (attrValues cfg.addons);
extraPolicies = {
FirefoxHome = {
Search = true;
Pocket = false;
Snippets = false;
TopSites = false;
Highlights = false;
};
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
SearchEngines = {
Default = "DuckDuckGo";
};
UserMessaging = {
ExtensionRecommendations = false;
FeatureRecommendations = false;
SkipOnboarding = true;
UrlbarInterventions = false;
WhatsNew = false;
};
# these were taken from Librewolf
AppUpdateURL = "https://localhost";
DisableAppUpdate = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DisableSystemAddonUpdate = true;
DisableFirefoxStudies = true;
DisableTelemetry = true;
DisableFeedbackCommands = true;
DisablePocket = true;
DisableSetDesktopBackground = false;
# remove many default search providers
# XXX this seems to prevent the `nixExtensions` from taking effect
# Extensions.Uninstall = [
# "google@search.mozilla.org"
# "bing@search.mozilla.org"
# "amazondotcom@search.mozilla.org"
# "ebay@search.mozilla.org"
# "twitter@search.mozilla.org"
# ];
# XXX doesn't seem to have any effect...
# docs: https://github.com/mozilla/policy-templates#homepage
# Homepage = {
# HomepageURL = "https://uninsane.org/";
# StartPage = "homepage";
# extraPolicies: only really required if using firefox; else, easier to configure this via overrides.cfg.
# extraPolicies = {
# FirefoxHome = {
# Search = true;
# Pocket = false;
# Snippets = false;
# TopSites = false;
# Highlights = false;
# };
# NoDefaultBookmarks = true;
# OfferToSaveLogins = false;
# OfferToSaveLoginsDefault = false;
# PasswordManagerEnabled = false;
# SearchEngines = {
# Default = "DuckDuckGo";
# };
# UserMessaging = {
# ExtensionRecommendations = false;
# FeatureRecommendations = false;
# SkipOnboarding = true;
# UrlbarInterventions = false;
# WhatsNew = false;
# };
# # these were taken from Librewolf
# AppUpdateURL = "https://localhost";
# DisableAppUpdate = true;
# OverrideFirstRunPage = "";
# OverridePostUpdatePage = "";
# DisableSystemAddonUpdate = true;
# DisableFirefoxStudies = true;
# DisableTelemetry = true;
# DisableFeedbackCommands = true;
# DisablePocket = true;
# DisableSetDesktopBackground = false;
# # remove many default search providers
# # XXX this seems to prevent the `nixExtensions` from taking effect
# # Extensions.Uninstall = [
# # "google@search.mozilla.org"
# # "bing@search.mozilla.org"
# # "amazondotcom@search.mozilla.org"
# # "ebay@search.mozilla.org"
# # "twitter@search.mozilla.org"
# # ];
# # XXX doesn't seem to have any effect...
# # docs: https://github.com/mozilla/policy-templates#homepage
# # Homepage = {
# # HomepageURL = "https://uninsane.org/";
# # StartPage = "homepage";
# # };
# # NewTabPage = true;
# };
# NewTabPage = true;
};
# extraPrefs = ...
}).overrideAttrs (base: {
nativeBuildInputs = (base.nativeBuildInputs or []) ++ [
@@ -234,8 +235,13 @@ in
fs.".librewolf/profiles.ini".symlink.target = "../.mozilla/firefox/profiles.ini";
fs.".librewolf/managed-storage".symlink.target = "../.mozilla/firefox/managed-storage";
# TODO: this is better suited in `extraPrefs` during `wrapFirefox` call
# N.B.: `overrides.cfg` might be librewolf-specific -- not supported by mainline firefox.
# firefox does support per-profile `user.js` files which have similar functionality.
fs.".mozilla/firefox/firefox.overrides.cfg".symlink.text = ''
// use `pref(...)` to force a preference
// use `defaultPref(...)` to allow runtime reconfiguration
// discover preference names via the `about:config` page
//
// if we can't query the revocation status of a SSL cert because the issuer is offline,
// treat it as unrevoked.
// see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do>
@@ -273,6 +279,8 @@ in
// - to update the static bookmarks, export via Hamburger => bookmarks => manage bookmarks => Import and Backup => Export Bookmarks To HTML
defaultPref("browser.places.importBookmarksHTML", true);
defaultPref("browser.bookmarks.file", "${./bookmarks.html}");
defaultPref("browser.startup.homepage", "https://uninsane.org/places");
'';
# instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it).