From 30b85d5685e7dd5b54bc084a22e570b0b4ced353 Mon Sep 17 00:00:00 2001 From: Christian Harke Date: Thu, 20 Jun 2024 08:58:24 +0200 Subject: [PATCH] Refactor FF config --- home/programs/firefox/default.nix | 207 +++++++++++++++++++----------- 1 file changed, 130 insertions(+), 77 deletions(-) diff --git a/home/programs/firefox/default.nix b/home/programs/firefox/default.nix index 935aa46c..d0d34a59 100644 --- a/home/programs/firefox/default.nix +++ b/home/programs/firefox/default.nix @@ -35,9 +35,68 @@ in programs.firefox = { inherit (cfg) enable; + policies = { + PasswordManagerEnabled = false; + DisableFirefoxAccounts = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + }; + FirefoxHome = { + Search = true; + TopSites = true; + SponsoredTopSites = false; + Highlights = false; + Locked = true; + }; + HomePage = { + URL = cfg.homepage; + StartPage = "homepage-locked"; + Locked = true; + }; + HttpsOnlyMode = "force_enabled"; + OfferToSaveLogins = false; + Preferences = { + "browser.newtabpage.pinned" = [ + { + label = "Blog"; + url = "https://blog.harke.ch"; + } + { + label = "Cloud"; + url = "https://cloud.harke.ch"; + } + { + label = "Code"; + url = "https://code.harke.ch"; + } + { + label = "News"; + url = "https://news.harke.ch"; + } + { + label = "ProtonMail"; + url = "https://mail.proton.me"; + } + ]; + "browser.search.suggest.enabled" = false; + "browser.search.region" = "CH"; + "cookiebanners.service.mode" = 1; + "cookiebanners.service.mode.privateBrowsing" = 1; + }; + }; + profiles."ztbvdcs8.default" = { inherit (cfg) extensions; + isDefault = true; + containers = { personal = { color = "turquoise"; @@ -75,90 +134,84 @@ in id = 6; name = "Danger Zone"; }; + Facebook = { + color = "toolbar"; + icon = "fence"; + id = 7; + name = "Facebook"; + }; }; - search = { - default = "Harke Search"; - engines = { - "Harke Search" = { - urls = [{ - template = "https://search.harke.ch/search"; - params = [ - { name = "q"; value = "{searchTerms}"; } - ]; - }]; - icon = ./icons/search.harke.ch.svg; - }; + containersForce = true; - "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ - { name = "query"; value = "{searchTerms}"; } - ]; - }]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; + search = + let + engines = { + harke = "Harke Search"; + nixPkgs = "Nix Packages"; + nixOpts = "NixOS Options"; + nixWiki = "NixOS Wiki"; }; + in + { + default = "Harke Search"; + engines = { + "${engines.harke}" = { + urls = [{ + template = "https://search.harke.ch/search"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + icon = ./icons/search.harke.ch.svg; + }; - "NixOS Options" = { - urls = [{ - template = "https://search.nixos.org/options"; - params = [ - { name = "query"; value = "{searchTerms}"; } - ]; - }]; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@no" ]; - }; + "${engines.nixPkgs}" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; - "NixOS Wiki" = { - urls = [{ - template = "https://nixos.wiki/index.php"; - params = [ - { name = "search"; value = "{searchTerms}"; } - ]; - }]; - iconUpdateURL = "https://nixos.wiki/favicon.png"; - updateInterval = 24 * 60 * 60 * 1000; # every day - definedAliases = [ "@nw" ]; - }; + "${engines.nixOpts}" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; + }; - "Amazon.de".metaData.hidden = true; - "Bing".metaData.hidden = true; - "eBay".metaData.hidden = true; - "Google".metaData.hidden = true; + "${engines.nixWiki}" = { + urls = [{ + template = "https://nixos.wiki/index.php"; + params = [ + { name = "search"; value = "{searchTerms}"; } + ]; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + + "Amazon.de".metaData.hidden = true; + "Bing".metaData.hidden = true; + "eBay".metaData.hidden = true; + "Google".metaData.hidden = true; + }; + force = true; + order = with engines; [ + harke + nixPkgs + nixOpts + nixWiki + ]; }; - force = true; - }; - settings = { - "browser.search.suggest.enabled" = false; - "browser.search.region" = "CH"; - "browser.startup.homepage" = cfg.homepage; - "browser.newtabpage.pinned" = [ - { - title = "Blog"; - url = "https://blog.harke.ch"; - } - { - title = "Cloud"; - url = "https://cloud.harke.ch"; - } - { - title = "Code"; - url = "https://code.harke.ch"; - } - { - title = "News"; - url = "https://news.harke.ch"; - } - { - title = "ProtonMail"; - url = "https://mail.proton.me"; - } - ]; - "cookiebanners.service.mode" = 1; - "cookiebanners.service.mode.privateBrowsing" = 1; - }; }; }; };