summary refs log tree commit diff
path: root/mixins/firefox/default.nix
blob: 3ab8795d3af817b814083adb95dbe4d34acb29ae (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
184
185
186
187
let
  profile = "default";
in
  {
    config,
    inputs,
    pkgs,
    ...
  }: {
    home-manager.users.tzlil = {
      /*
      TODO
      figure out if you like sidebery or TST more
      if sidebery: figure out where options are stored so you can set colors declaratively and also tree groups
      also figure out how to make ctrl+e for SB not conflict with vimium, maybe will rebind to F1
      figure out the search engine crap, i have them hidden but id like them removed completely, Extensions.Uninstall and SearchEngines.Remove did nothing
      incorporate user.js instead of hardcoding some shit myself
      */
      home.file.".mozilla/firefox/default/browser-extension-data/redirector@einaregilsson.com/storage.js".text = builtins.toJSON {
        redirects =
          map ({
            includePattern,
            redirectUrl,
            description,
          }: {
            appliesTo = ["main_frame"];
            inherit description;
            disabled = false;
            error = null;
            exampleResult = "";
            exampleUrl = "";
            excludePattern = "";
            grouped = false;
            inherit includePattern;
            patternDesc = "";
            patternType = "W";
            processMatches = "noProcessing";
            inherit redirectUrl;
          }) [
            {
              includePattern = "https://*youtube.com/watch?*v=*";
              redirectUrl = "https://yewtu.be/watch?$2v=$3}";
              description = "invidious";
            }
            {
              includePattern = "https://*youtube.com/results?*search_query=*";
              redirectUrl = "https://yewtu.be/search?$2q=$3";
              description = "invidious search";
            }
          ];
        enableNotifications = false;
      };
      programs.firefox = {
        enable = true;
        package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
          extraPolicies = {
            OverrideFirstRunPage = "";
            Extensions = {
              Install = map (x: x.src.outPath) config.home-manager.users.tzlil.programs.firefox.profiles."default".extensions;
              # Uninstall = [
              #   "google@search.mozilla.org"
              #   "amazondotcom@search.mozilla.org"
              #   "wikipedia@search.mozilla.org"
              #   "bing@search.mozilla.org"
              # ];
            };
            # SearchEngines.Remove = [
            #   "Amazon"
            #   "Bing"
            #   "Google"
            #   "Twitter"
            #   "Wikipedia"
            #   "Yahoo"
            # ];
          };
        };
        profiles."${profile}" = {
          search = {
            default = "DuckDuckGo";
            force = true;
          };
          userChrome = builtins.readFile ./userChrome.css;
          extensions = with inputs.firefox-addons.packages.${pkgs.system}; [
            # privacy crap
            ublock-origin
            clearurls
            darkreader
            privacy-possum
            smart-referer
            # localcdn
            canvasblocker
            history-cleaner

            # usability crap
            vimium
            # tree-style-tab
            sidebery
            redirector
            demodal
            kristofferhagen-nord-theme
            # new-tab-override

            # misc
            snowflake
            # (flagfox.overrideAttrs {meta.license.free = true;})
          ];
          settings = {
            # for custom browser style
            "toolkit.legacyUserProfileCustomizations.stylesheets" = true;

            "browser.newtabpage.pinned" = [
              {url = "https://tzlil.net";}
            ];
            "browser.startup.homepage" = "https://lobste.rs";

            "extensions.activeThemeID" = "{e410fec2-1cbd-4098-9944-e21e708418af}";

            "browser.toolbars.bookmarks.visibility" = "always";
            "browser.uidensity" = 1;
            "browser.aboutConfig.showWarning" = false;
            "browser.shell.checkDefaultBrowser" = false;

            "browser.search.hiddenOneOffs" = "Google,Bing,Amazon.com,eBay,Twitter,Wikipedia (en)";

            "browser.download.dir" = config.home-manager.users.tzlil.xdg.userDirs.download;
            # privacy crap
            "app.normandy.enabled" = false;
            "app.shield.optoutstudies.enabled" = false;
            "app.update.auto" = false;
            "beacon.enabled" = false;
            "breakpad.reportURL" = "";
            "browser.tabs.inTitlebar" = 0;
            "browser.compactmode.show" = true;
            "browser.contentblocking.category" = "strict";
            "browser.crashReports.unsubmittedCheck.enabled" = false;
            "browser.discovery.enabled" = false;
            "browser.newtab.preload" = false;
            "browser.newtabpage.activity-stream.enabled" = false;
            "browser.newtabpage.activity-stream.feeds.section.topstories" = false;
            "browser.newtabpage.activity-stream.telemetry" = false;
            "browser.ping-centre.telemetry" = false;
            "browser.pocket.enabled" = false;
            "browser.safebrowsing.malware.enabled" = true;
            "browser.safebrowsing.phishing.enabled" = true;
            "browser.send_pings" = false;
            "browser.tabs.crashReporting.sendReport" = false;
            "signon.autofillForms" = false;
            "media.autoplay.default" = 2;
            "device.sensors.enabled" = false;
            "datareporting.healthreport.service.enabled" = false;
            "datareporting.healthreport.uploadEnabled" = false;
            "datareporting.policy.dataSubmissionEnabled" = false;
            "dom.security.https_only_mode" = true;
            "dom.battery.enabled" = false;
            "experiments.enabled" = false;
            "experiments.supported" = false;
            "extensions.pocket.enabled" = false;
            "extensions.shield-recipe-client.enabled" = false;
            "network.dns.blockDotOnion" = true;
            "network.stricttransportsecurity.preloadlist" = true;
            "privacy.donottrackheader.enabled" = true;
            "privacy.firstparty.isolate" = true;
            "privacy.trackingprotection.cryptomining.enabled" = true;
            "privacy.trackingprotection.enabled" = true;
            "privacy.trackingprotection.fingerprinting.enabled" = true;
            "privacy.trackingprotection.pbmode.enabled" = true;
            "privacy.trackingprotection.socialtracking.enabled" = true;
            "security.insecure_password.ui.enabled" = true;
            "security.ssl.errorReporting.automatic" = false;
            "services.sync.engine.addons" = false;
            "services.sync.addons.ignoreUserEnabledChanges" = true;
            "toolkit.telemetry.archive.enabled" = false;
            "toolkit.telemetry.bhrPing.enabled" = false;
            "toolkit.telemetry.enabled" = false;
            "toolkit.telemetry.firstShutdownPing.enabled" = false;
            "toolkit.telemetry.hybridContent.enabled" = false;
            "toolkit.telemetry.newProfilePing.enabled" = false;
            "toolkit.telemetry.reportingpolicy.firstRun" = false;
            "toolkit.telemetry.server" = "";
            "toolkit.telemetry.shutdownPingSender.enabled" = false;
            "toolkit.telemetry.unified" = false;
            "toolkit.telemetry.updatePing.enabled" = false;
          };
        };
      };
    };
  }