summaryrefslogtreecommitdiff
path: root/hm/soft/browser.nix
blob: 7223b2725ee982152220f8e5be1ba3aa14b48e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
{
  config,
  lib,
  pkgs,
  inputs,
  ...
}:
let
  cfg = config.hm.soft.browser;
in
{
  options.hm.soft.browser = {
    librewolf.enable = lib.mkEnableOption "LibreWolf browser";
    brave.enable = lib.mkEnableOption "Brave browser";
  };
  imports = [ inputs.arkenfox.hmModules.arkenfox ];
  config = lib.mkMerge [
    (lib.mkIf cfg.librewolf.enable {
      programs.librewolf = {
        enable = true;
        # arkenfox = {
        #   enable = true;
        #   version = "148.0.2-2";
        # };
        settings = {
          "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
        };

        profiles = {
          main = {
            id = 0;
            name = "main";
            isDefault = true;
            search = {
              force = true;
              engines = {
                "google".metaData.hidden = true;
                "bing".metaData.hidden = true;
                # "ddg".metaData.hidden = true;
                "perplexity".metaData.hidden = true;
                "wikipedia".metaData.hidden = true;
                "policy-DuckDuckGo Lite".metaData.hidden = true;
                "policy-Searx Belgium".metaData.hidden = true;
                "policy-MetaGer".metaData.hidden = true;
                "policy-Startpage".metaData.hidden = true;
                "policy-Mojeek".metaData.hidden = true;

                "OmniSearch" = {
                  urls = [ { template = "http://omnisearch.local:8087/search?q={searchTerms}"; } ];
                  definedAliases = [ "@o" ];
                };
                "SearXNG" = {
                  urls = [ { template = "https://sxng.violets-purgatory.dev/search?q={searchTerms}"; } ];
                  definedAliases = [ "@s" ];
                };
                "NixOS Packages" = {
                  urls = [ { template = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}"; } ];
                  icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
                  definedAliases = [ "@np" ];
                };
                "NixOS Options" = {
                  urls = [ { template = "https://search.nixos.org/options?channel=unstable&query={searchTerms}"; } ];
                  icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
                  definedAliases = [ "@no" ];
                };
                "Home Manager Options" = {
                  urls = [
                    { template = "https://home-manager-options.extranix.com/?query={searchTerms}&release=master"; }
                  ];
                  icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
                  definedAliases = [ "@hm" ];
                };
              };
            };
            extensions = {
              force = true;
              packages = with pkgs.nur.repos.rycee.firefox-addons; [
                vimium
                sidebery
                bitwarden
                buster-captcha-solver
                sponsorblock
                dearrow
                darkreader
                i-dont-care-about-cookies
                keepassxc-browser
              ];
            };
            settings = {
              "identity.fxaccounts.enabled" = true;
              "extensions.autoDisableScopes" = 0;
              # --- Privacy & Fingerprinting ---
              "privacy.resistFingerprinting" = true;
              "privacy.fingerprintingProtection" = true;
              "privacy.query_stripping.enabled" = true;
              "privacy.query_stripping.enabled.pbmode" = true;
              "privacy.trackingprotection.enabled" = true;
              "privacy.trackingprotection.socialtracking.enabled" = true;
              "privacy.trackingprotection.emailtracking.enabled" = true;
              "privacy.bounceTrackingProtection.mode" = 1;
              "privacy.annotate_channels.strict_list.enabled" = true;
              "privacy.clearOnShutdown_v2.formdata" = true;

              # --- Data Collection & Form Security ---
              "dom.forms.autocomplete.formautofill" = false;
              "signon.management.page.breach-alerts.enabled" = false;
              "browser.translations.enable" = false;
              "browser.region.update.enabled" = false;

              # --- Search & URL Bar ---
              "browser.urlbar.shortcuts.bookmarks" = false;
              "browser.urlbar.shortcuts.history" = false;
              "browser.urlbar.shortcuts.tabs" = false;
              "browser.urlbar.shortcuts.actions" = false;
              "browser.urlbar.showSearchTerms.enabled" = false;

              # --- Networking & Performance ---
              "network.proxy.type" = 0;
              "network.prefetch-next" = false;
              "network.predictor.enabled" = false;
              "network.http.speculative-parallel-limit" = 0;
              "network.early-hints.preconnect.max_connections" = 0;
              "network.connectivity-service.enabled" = false;
              "network.captive-portal-service.enabled" = false;
              "security.tls.enable_0rtt_data" = false;

              # --- Interface & De-clutter ---
              "browser.startup.page" = 3;
              "browser.startup.homepage" = "chrome://browser/content/blanktab.html";
              "browser.newtabpage.enabled" = false;
              "browser.newtabpage.activity-stream.showSearch" = false;
              "browser.newtabpage.activity-stream.showSponsoredCheckboxes" = false;
              "browser.bookmarks.restore_default_bookmarks" = false;
              "media.hardwaremediakeys.enabled" = false;
              "media.videocontrols.picture-in-picture.video-toggle.enabled" = false;
              "layout.spellcheckDefault" = 0;

              # --- Safe Browsing (Privacy Trade-off) ---
              "browser.safebrowsing.downloads.remote.enabled" = false;
              "browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false;
              "browser.safebrowsing.downloads.remote.block_uncommon" = false;
            };
            userChrome = ''
              #TabsToolbar { visibility: collapse !important; }
              #sidebar-header { display: none !important; }
              #toolbar-menubar { display: none !important; }
            '';
          };
          privacy = {
            id = 1;
            name = "I2P";
            settings = {
              "media.peerconnection.enabled" = false;
              "network.proxy.type" = 1;

              "network.proxy.http" = "127.0.0.1";
              "network.proxy.http_port" = 4444;

              "network.proxy.ssl" = "127.0.0.1";
              "network.proxy.ssl_port" = 4444;

              "network.proxy.no_proxies_on" = "localhost, 127.0.0.1";

              "network.http.proxy.pipelining" = true;
              "network.proxy.share_proxy_settings" = true;

              "network.prefetch-next" = false;
              "network.dns.disablePrefetch" = true;
            };
            userChrome = ''
              #TabsToolbar { visibility: collapse !important; }
              #sidebar-header { display: none !important; }
              #toolbar-menubar { display: none !important; }
            '';
          };
        };
      };
    })
    (lib.mkIf cfg.brave.enable {
      home.packages = [ pkgs.brave ];
    })
  ];
}