From a2d348cca0dbbbfe9bb875092527621ba037b960 Mon Sep 17 00:00:00 2001 From: caem Date: Sat, 25 Jan 2025 03:17:55 +0100 Subject: [PATCH] tomfoolery --- .../multimedia/web/firefox/policies.json | 62 ------------------- .../nixos/multimedia/web/firefox/policies.nix | 61 ++++++++++++++++++ overlays/nixpak/firefox.nix | 8 +-- 3 files changed, 64 insertions(+), 67 deletions(-) delete mode 100644 modules/nixos/multimedia/web/firefox/policies.json create mode 100644 modules/nixos/multimedia/web/firefox/policies.nix diff --git a/modules/nixos/multimedia/web/firefox/policies.json b/modules/nixos/multimedia/web/firefox/policies.json deleted file mode 100644 index 6044a95..0000000 --- a/modules/nixos/multimedia/web/firefox/policies.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "policies": { - "EnableTrackingProtection": { - "Value": true, - "Cryptomining": true, - "Fingerprinting": true, - "EmailTracking": true, - "Level": "strict" - }, - "DisableTelemetry": true, - "DisablePocket": true, - "DisableFirefoxStudies": true, - "DisableFirefoxAccounts": false, - "DisableAccounts": false, - "DontCheckDefaultBrowser": true, - "OverrideFirstRunPage": "", - "OverridePostUpdatePage": "", - "NoDefaultBookmarks": true, - "Cookies": { - "Behavior": "reject-foreign", - "BehaviorPrivateBrowsing": "reject-foreign" - }, - "UserMessaging": { - "WhatsNew": false, - "ExtensionRecommendations": false, - "FeatureRecommendations": false, - "UrlbarInterventions": false, - "SkipOnboarding": true, - "MoreFromMozilla": false - }, - "FirefoxHome": { - "Search": true, - "TopSites": true, - "SponsoredTopSites": false, - "Highlights": false, - "Pocket": false, - "SponsoredPocket": false, - "Snippets": false, - "Locked": true - }, - "SearchSuggestEnabled": false, - "NewTabPage": false, - "SearchEngines": { - "Add": [ - { - "Name": "Kagi", - "URLTemplate": "https://kagi.com/search?q={searchTerms}", - "Method": "GET", - "IconURL": "https://kagi.com/favicon.ico", - "Alias": "@k", - "Default": true - } - ], - "Remove": [ - "Bing", - "Google", - "DuckDuckGo", - "Wikipedia (en)" - ] - } - } -} diff --git a/modules/nixos/multimedia/web/firefox/policies.nix b/modules/nixos/multimedia/web/firefox/policies.nix new file mode 100644 index 0000000..e9b8e20 --- /dev/null +++ b/modules/nixos/multimedia/web/firefox/policies.nix @@ -0,0 +1,61 @@ +{ + EnableTrackingProtection = { + Value = true; + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + Level = "strict"; + }; + + DisableTelemetry = true; + DisablePocket = true; + DisableFirefoxStudies = true; + DisableFirefoxAccounts = false; + DisableAccounts = false; + DontCheckDefaultBrowser = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + NoDefaultBookmarks = true; + Cookies = { + Behaviour = "reject-foreign"; + BehaviourPrivateBrowsing = "reject-foreign"; + }; + + UserMessaging = { + WhatsNew = false; + ExtensionRecommendations = false; + FeatureRecommendations = false; + UrlbarInterventions = false; + SkipOnboarding = true; + MoreFromMozilla = false; + }; + + FirefoxHome = { + Search = true; + TopSites = true; + SponsoredTopSites = false; + Highlights = false; + Pocket = false; + SponsoredPocket = false; + Snippets = false; + Locked = true; + }; + + SearchSuggestEnabled = false; + ShowSearchSuggestionsFirst = false; + NewTabPage = false; + + SearchEngines = { # ESR only + Add = [ + { + Name = "Kagi"; + URLTemplate = "https://kagi.com/search?q={searchTerms}"; + Method = "GET"; + IconURL = "https://kagi.com/favicon.ico"; + Alias = "@k"; + Default = true; + } + ]; + Remove = [ "Bing" "Google" "DuckDuckGo" "Wikipedia (en)" ]; + }; +} diff --git a/overlays/nixpak/firefox.nix b/overlays/nixpak/firefox.nix index 82bb58d..00d4120 100644 --- a/overlays/nixpak/firefox.nix +++ b/overlays/nixpak/firefox.nix @@ -4,11 +4,9 @@ { cfgPath, ... }: final: prev: { firefox-esr = let - intermediary-firefox-esr = prev.firefox-esr.overrideAttrs (oldAttrs: { - postInstall = (oldAttrs.postInstall or "") + '' - cp "${cfgPath}/modules/nixos/multimedia/web/firefox/polcies.json" $out/lib/distribution/policies.json - ''; - }); + intermediary-firefox-esr = prev.firefox-esr.override { + extraPolicies = import "${cfgPath}/modules/nixos/multimedia/web/firefox/polcies.nix"; + }; sandboxed-firefox-esr = prev.mkNixPak { config = { sloth, ... }: {