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); nixExtensions = concatMap (ext: optional ext.enable ext.package) (attrValues cfg.addons);
extraPolicies = { # extraPolicies: only really required if using firefox; else, easier to configure this via overrides.cfg.
FirefoxHome = { # extraPolicies = {
Search = true; # FirefoxHome = {
Pocket = false; # Search = true;
Snippets = false; # Pocket = false;
TopSites = false; # Snippets = false;
Highlights = false; # TopSites = false;
}; # Highlights = false;
NoDefaultBookmarks = true; # };
OfferToSaveLogins = false; # NoDefaultBookmarks = true;
OfferToSaveLoginsDefault = false; # OfferToSaveLogins = false;
PasswordManagerEnabled = false; # OfferToSaveLoginsDefault = false;
SearchEngines = { # PasswordManagerEnabled = false;
Default = "DuckDuckGo"; # SearchEngines = {
}; # Default = "DuckDuckGo";
UserMessaging = { # };
ExtensionRecommendations = false; # UserMessaging = {
FeatureRecommendations = false; # ExtensionRecommendations = false;
SkipOnboarding = true; # FeatureRecommendations = false;
UrlbarInterventions = false; # SkipOnboarding = true;
WhatsNew = false; # UrlbarInterventions = false;
}; # WhatsNew = false;
# };
# these were taken from Librewolf
AppUpdateURL = "https://localhost"; # # these were taken from Librewolf
DisableAppUpdate = true; # AppUpdateURL = "https://localhost";
OverrideFirstRunPage = ""; # DisableAppUpdate = true;
OverridePostUpdatePage = ""; # OverrideFirstRunPage = "";
DisableSystemAddonUpdate = true; # OverridePostUpdatePage = "";
DisableFirefoxStudies = true; # DisableSystemAddonUpdate = true;
DisableTelemetry = true; # DisableFirefoxStudies = true;
DisableFeedbackCommands = true; # DisableTelemetry = true;
DisablePocket = true; # DisableFeedbackCommands = true;
DisableSetDesktopBackground = false; # DisablePocket = true;
# DisableSetDesktopBackground = false;
# remove many default search providers
# XXX this seems to prevent the `nixExtensions` from taking effect # # remove many default search providers
# Extensions.Uninstall = [ # # XXX this seems to prevent the `nixExtensions` from taking effect
# "google@search.mozilla.org" # # Extensions.Uninstall = [
# "bing@search.mozilla.org" # # "google@search.mozilla.org"
# "amazondotcom@search.mozilla.org" # # "bing@search.mozilla.org"
# "ebay@search.mozilla.org" # # "amazondotcom@search.mozilla.org"
# "twitter@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 # # XXX doesn't seem to have any effect...
# Homepage = { # # docs: https://github.com/mozilla/policy-templates#homepage
# HomepageURL = "https://uninsane.org/"; # # Homepage = {
# StartPage = "homepage"; # # HomepageURL = "https://uninsane.org/";
# # StartPage = "homepage";
# # };
# # NewTabPage = true;
# }; # };
# NewTabPage = true;
};
# extraPrefs = ... # extraPrefs = ...
}).overrideAttrs (base: { }).overrideAttrs (base: {
nativeBuildInputs = (base.nativeBuildInputs or []) ++ [ nativeBuildInputs = (base.nativeBuildInputs or []) ++ [
@@ -234,8 +235,13 @@ in
fs.".librewolf/profiles.ini".symlink.target = "../.mozilla/firefox/profiles.ini"; fs.".librewolf/profiles.ini".symlink.target = "../.mozilla/firefox/profiles.ini";
fs.".librewolf/managed-storage".symlink.target = "../.mozilla/firefox/managed-storage"; 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 = '' 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, // if we can't query the revocation status of a SSL cert because the issuer is offline,
// treat it as unrevoked. // treat it as unrevoked.
// see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do> // 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 // - 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.places.importBookmarksHTML", true);
defaultPref("browser.bookmarks.file", "${./bookmarks.html}"); 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). # instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it).