From 6b3b72372268d02c1a08ec49c87049dcb1218dca Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 15 Nov 2024 15:27:19 -0500 Subject: [PATCH] get extraPrefs working for nix firefox --- home/nix/flake.lock | 6 ++-- home/nix/programs/firefox.nix | 58 +++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/home/nix/flake.lock b/home/nix/flake.lock index 4e290a2..e452c03 100644 --- a/home/nix/flake.lock +++ b/home/nix/flake.lock @@ -60,11 +60,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730651795, - "narHash": "sha256-XGYmN3WdyGU8FasWLPjL1Yvm9L9GJ0h62fMgCOPyvo0=", + "lastModified": 1731684989, + "narHash": "sha256-FQdoHR4vqYZlk2qp1jD3rtKufseLiPFr8rctGNY0d5Y=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5012ef7926747f739c65bd2e1ceff96da30fb3b8", + "rev": "1c6112d535e8f51e40d8f68eb0565afb2944ebba", "type": "github" }, "original": { diff --git a/home/nix/programs/firefox.nix b/home/nix/programs/firefox.nix index 61aba8c..5e89ef3 100644 --- a/home/nix/programs/firefox.nix +++ b/home/nix/programs/firefox.nix @@ -8,11 +8,44 @@ Value = true; Status = "locked"; }; - nixGL = import ./nixGL.nix { inherit pkgs nixgl; }; in { programs.firefox = { enable = true; + package = pkgs.firefox.override { + extraPrefs = '' + // + + // Automatically click cookiebanners although uBlock Origin might block them + lockPref("cookiebanners.bannerClicking.enabled", true); + lockPref("cookiebanners.service.mode", 2); + lockPref("cookiebanners.service.mode.privateBrowsing", 2); + + // DNT although PrivacyBadger from policy handles this + lockPref("privacy.donottrackheader.enabled", true); + lockPref("privacy.donottrackheader.value", 1); + + // Fingerprinting + lockPref("privacy.fingerprintingProtection", true); + pref( + "privacy.fingerprintingProtection.overrides", + "+AllTargets,-KeyboardEvents,-SpeechSynthesis,-CSSPrefersColorScheme,-CSSPrefersReducedMotion,-NavigatorUserAgent,-JSDateTimeUTC,-HttpUserAgent", + ); + lockPref("privacy.fingerprintingProtection.pbmode", true); + lockPref("privacy.resistFingerprinting", false); + lockPref("privacy.resistFingerprinting.block_mozAddonManage", true); + lockPref("privacy.resistFingerprinting.letterboxing", false); + clearPref("privacy.resistFingerprinting.pbmode"); + + // New sidebar + lockPref("sidebar.revamp", true); + lockPref("sidebar.verticalTabs", true); + lockPref("sidebar.visibility", "always-show"); + lockPref("sidebar.main.tools", ""); + + // + ''; + }; policies = { EnableTrackingProtection = { @@ -81,7 +114,7 @@ # Start Page Homepage = { StartPage = "previous-session"; - Loked = true; + Locked = true; }; # Home Page @@ -186,6 +219,10 @@ Value = "firefox-compact-dark@mozilla.org"; Status = "locked"; }; + "layout.css.prefers-color-scheme.content-override" = { + Value = 0; + Status = "locked"; + }; # homepage "browser.startup.homepage" = { Value = " about:home"; @@ -243,6 +280,13 @@ "browser.newtabpage.activity-stream.showSponsored" = lock-false; "browser.newtabpage.activity-stream.system.showSponsored" = lock-false; "browser.newtabpage.activity-stream.showSponsoredTopSites" = lock-false; + "browser.newtabpage.activity-stream.showWeather" = lock-false; + "browser.newtabpage.activity-stream.newtabWallpapers.enabled" = lock-false; + "browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled" = lock-false; + "browser.newtabpage.activity-stream.default.sites" = { + Value = ""; + Status = "locked"; + }; # safebrowsing "browser.safebrowsing.malware.enabled" = lock-true; "browser.safebrowsing.phishing.enabled" = lock-true; @@ -256,16 +300,6 @@ }; "browser.tabs.warnOnClose" = lock-true; "browser.tabs.firefox-view" = lock-false; - "sidebar.revamp" = { - Comment = "Preference not allowed for stability reasons."; - Status = "default"; - Type = "boolean"; - Value = true; - }; - "sidebar.main.tools" = { - Value = ""; - Status = "locked"; - }; "browser.tabs.closeTabByDblclick" = lock-true; "ui.key.menuAccessKeyFocuses" = lock-false; # general settings