From 140f53faa36927eded6efef746d4ab43091a3673 Mon Sep 17 00:00:00 2001 From: KP64 Date: Fri, 27 Dec 2024 14:06:01 +0100 Subject: [PATCH] add: firefox i2p profile --- programs/browsers/firefox/default.nix | 435 ++++++++++++++------------ 1 file changed, 241 insertions(+), 194 deletions(-) diff --git a/programs/browsers/firefox/default.nix b/programs/browsers/firefox/default.nix index d1092e9..c03ff87 100644 --- a/programs/browsers/firefox/default.nix +++ b/programs/browsers/firefox/default.nix @@ -26,234 +26,281 @@ in config = lib.mkMerge [ (lib.mkIf cfg.enable { home-manager.users.${username} = { + + xdg.desktopEntries = { + i2p-browser = { + name = "i2p Browser"; + genericName = "Web Browser"; + exec = "${pkgs.firefox}/bin/firefox -p i2p"; + }; + }; + home.file.".mozilla/firefox/${username}/chrome" = { source = "${inputs.potato-fox}/chrome/"; recursive = true; }; programs.firefox = { enable = true; - profiles.${username} = { - extraConfig = builtins.readFile "${inputs.potato-fox}/user.js"; - search = { - force = true; - default = "SearXNG"; - privateDefault = "SearXNG"; - engines = - let - nix-snowflake-icon = "${nixos-icons}/nix-snowflake.svg"; - nix-search-params = [ - { - name = "channel"; - value = "unstable"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - in - hideEngines [ - "Bing" - "Google" - "DuckDuckGo" - "Wikipedia (en)" - "LibRedirect" - ] - // { - SearXNG = { - urls = [ - { - template = "https://search.sapti.me/search"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - { - name = "language"; - value = "all"; - } - ]; - } - ]; - icon = ./searxng.svg; - definedAliases = [ "@sx" ]; - }; - "Home Manager" = { - urls = [ - { - template = "https://home-manager-options.extranix.com"; - params = [ - { - name = "query"; - value = "{searchTerms}"; - } - { - name = "release"; - value = "master"; - } - ]; - } - ]; - icon = nix-snowflake-icon; - definedAliases = [ "@hm" ]; + profiles = { + i2p = { + id = 1; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + noscript + ublock-origin + ]; + settings = collectLastEntries (appendLastWithFullPath { + keyword.enabled = false; + browser = { + contentblocking.category = "standard"; + policies.applied = true; + }; + network = { + trr.mode = 5; + proxy = { + backup.ssl = ""; + backup.ssl_port = 0; + http = "127.0.0.1"; + http_port = 4444; + share_proxy_settings = true; + socks = "127.0.0.1"; + socks_port = 4447; + ssl = "127.0.0.1"; + ssl_port = 4444; + type = 1; + # no_proxies_on = "localhost, 127.0.0.1"; }; - "Nix Packages" = { - urls = [ + }; + dom.security = { + https_only_mode = false; + https_only_mode_ever_enabled = false; + https_only_mode_ever_enabled_pbm = false; + https_only_mode_pbm = false; + }; + }); + }; + ${username} = { + extraConfig = builtins.readFile "${inputs.potato-fox}/user.js"; + search = { + force = true; + default = "SearXNG"; + privateDefault = "SearXNG"; + engines = + let + nix-snowflake-icon = "${nixos-icons}/nix-snowflake.svg"; + nix-search-params = [ { - template = "https://search.nixos.org/packages"; - params = nix-search-params; + name = "channel"; + value = "unstable"; } - ]; - icon = nix-snowflake-icon; - definedAliases = [ "@np" ]; - }; - "Nix Options" = { - urls = [ { - template = "https://search.nixos.org/options"; - params = nix-search-params; + name = "query"; + value = "{searchTerms}"; } ]; - icon = nix-snowflake-icon; - definedAliases = [ "@no" ]; - }; - "NixOS Wiki" = { - urls = [ { template = "https://wiki.nixos.org/wiki/{searchTerms}"; } ]; - updateInterval = 24 * 60 * 60 * 1000; # every day - icon = nix-snowflake-icon; - definedAliases = [ "@nw" ]; + in + hideEngines [ + "Bing" + "Google" + "DuckDuckGo" + "Wikipedia (en)" + "LibRedirect" + ] + // { + SearXNG = { + urls = [ + { + template = "https://search.sapti.me/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + { + name = "language"; + value = "all"; + } + ]; + } + ]; + icon = ./searxng.svg; + definedAliases = [ "@sx" ]; + }; + "Home Manager" = { + urls = [ + { + template = "https://home-manager-options.extranix.com"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + { + name = "release"; + value = "master"; + } + ]; + } + ]; + icon = nix-snowflake-icon; + definedAliases = [ "@hm" ]; + }; + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = nix-search-params; + } + ]; + icon = nix-snowflake-icon; + definedAliases = [ "@np" ]; + }; + "Nix Options" = { + urls = [ + { + template = "https://search.nixos.org/options"; + params = nix-search-params; + } + ]; + icon = nix-snowflake-icon; + definedAliases = [ "@no" ]; + }; + "NixOS Wiki" = { + urls = [ { template = "https://wiki.nixos.org/wiki/{searchTerms}"; } ]; + updateInterval = 24 * 60 * 60 * 1000; # every day + icon = nix-snowflake-icon; + definedAliases = [ "@nw" ]; + }; }; - }; - }; - settings = collectLastEntries (appendLastWithFullPath { - browser = { - aboutConfig.showWarning = false; - aboutwelcome.enabled = false; - contentblocking.category = "strict"; - shell.checkDefaultBrowser = false; - tabs.crashReporting.sendReport = false; - discovery.enabled = false; - download.manager.addToRecentDocs = false; - bookmarks.openInTabClosesMenu = false; - translations.neverTranslateLanguages = "ar,de"; # Comma Seperated - uitour.enabled = false; - profiles.enabled = true; - privatebrowsing.forceMediaMemoryCache = true; - search.separatePrivateDefault.ui.enabled = true; - places.speculativeConnect.enabled = false; - urlbar = { - speculativeConnect.enabled = false; + }; + settings = collectLastEntries (appendLastWithFullPath { + browser = { + aboutConfig.showWarning = false; + aboutwelcome.enabled = false; + contentblocking.category = "strict"; + shell.checkDefaultBrowser = false; + tabs.crashReporting.sendReport = false; + discovery.enabled = false; + download.manager.addToRecentDocs = false; + bookmarks.openInTabClosesMenu = false; + translations.neverTranslateLanguages = "ar,de"; # Comma Seperated + uitour.enabled = false; + profiles.enabled = true; + privatebrowsing.forceMediaMemoryCache = true; + search.separatePrivateDefault.ui.enabled = true; + places.speculativeConnect.enabled = false; urlbar = { - suggest = { - engines = false; - calculator = true; + speculativeConnect.enabled = false; + urlbar = { + suggest = { + engines = false; + calculator = true; + }; + unitConversion.enabled = true; + trending.featureGate = false; }; - unitConversion.enabled = true; - trending.featureGate = false; }; }; - }; - middlemouse.paste = false; - general.autoScroll = true; + middlemouse.paste = false; + general.autoScroll = true; - extensions = { - autoDisableScopes = 0; - webcompat-reporter.enabled = false; - pocket.enabled = false; - htmlaboutaddons.recommendations.enabled = false; - }; + extensions = { + autoDisableScopes = 0; + webcompat-reporter.enabled = false; + pocket.enabled = false; + htmlaboutaddons.recommendations.enabled = false; + }; - findbar.highlightAll = true; + findbar.highlightAll = true; - security = { - OCSP.enabled = 0; - remote_settings.crlite_filters.enabled = true; - pki.crlite_mode = 2; - }; - - dom = { security = { - https_only_mode = true; - https_first = true; - sanitizer.enabled = true; - }; - battery.enabled = false; - push = { - enabled = false; - connection.enabled = false; + OCSP.enabled = 0; + remote_settings.crlite_filters.enabled = true; + pki.crlite_mode = 2; }; - }; - policies = { - DisableFirefoxStudies = true; - DisableTelemetry = true; - }; + dom = { + security = { + https_only_mode = true; + https_first = true; + sanitizer.enabled = true; + }; + battery.enabled = false; + push = { + enabled = false; + connection.enabled = false; + }; + }; - privacy = { - globalprivacycontrol.enabled = true; - donottrackheader.enabled = true; - fingerprintingProtection = true; - trackingprotection = { - enabled = true; - socialtracking.enabled = true; + policies = { + DisableFirefoxStudies = true; + DisableTelemetry = true; }; - userContext = { - enabled = true; - ui.enabled = true; + + privacy = { + globalprivacycontrol.enabled = true; + donottrackheader.enabled = true; + fingerprintingProtection = true; + trackingprotection = { + enabled = true; + socialtracking.enabled = true; + }; + userContext = { + enabled = true; + ui.enabled = true; + }; }; - }; - app = { - normandy.enabled = false; - shield.optoutstudies.enabled = false; - }; + app = { + normandy.enabled = false; + shield.optoutstudies.enabled = false; + }; - beacon.enabled = false; - device.sensors.enabled = false; - geo.enabled = false; + beacon.enabled = false; + device.sensors.enabled = false; + geo.enabled = false; - network = { - dns = { - disablePrefetch = true; - disablePrefetchFromHTTPS = true; + network = { + dns = { + disablePrefetch = true; + disablePrefetchFromHTTPS = true; + }; + predictor.enabled = false; + security.esni.enabled = true; }; - predictor.enabled = false; - security.esni.enabled = true; - }; - toolkit.telemetry = { - enabled = false; - archive.enabled = false; - unified = false; - }; + toolkit.telemetry = { + enabled = false; + archive.enabled = false; + unified = false; + }; - datareporting = { - policy.dataSubmissionEnabled = false; - healthreport.uploadEnabled = false; - }; - }); + datareporting = { + policy.dataSubmissionEnabled = false; + healthreport.uploadEnabled = false; + }; + }); - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - catppuccin-gh-file-explorer - darkreader - enhancer-for-youtube - facebook-container - firefox-color - i-dont-care-about-cookies - languagetool - libredirect - private-relay - refined-github - return-youtube-dislikes - sidebery - simple-translate - stylus - ublock-origin - userchrome-toggle-extended - videospeed - ]; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + catppuccin-gh-file-explorer + darkreader + enhancer-for-youtube + facebook-container + firefox-color + i-dont-care-about-cookies + languagetool + libredirect + private-relay + refined-github + return-youtube-dislikes + sidebery + simple-translate + stylus + ublock-origin + userchrome-toggle-extended + videospeed + ]; + }; }; }; };