summary refs log tree commit diff
path: root/mixins/firefox/minimum/default.nix
blob: a207eb5bc17399f2d1fdb28299faa61ae0b11451 (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
let
  profile = "default";
  prf = ".mozilla/firefox/${profile}";
  extstorage = "${prf}/browser-extension-data";
in
  {
    config,
    inputs,
    pkgs,
    lib,
    ...
  }: {
    home-manager.users.tzlil = let
      firefox-addons = pkgs.callPackage (pkgs.applyPatches {
        src = inputs.firefox-addons;
        #patches = [./addons-passthru.patch];
        name = "firefox-addons-patched";
      }) {};
      mozlz4 = n: x:
        pkgs.runCommand "${n}.lz4" {buildInputs = [pkgs.mozlz4a];} ''
          mozlz4a ${pkgs.writeTextFile {
            name = n;
            text = builtins.toJSON x;
          }} $out
        '';
      cfg = config.home-manager.users.tzlil.programs;
      addons = cfg.firefox.profiles.${profile}.extensions;
      extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";

      firefoxData =
        pkgs.runCommand "firefox-default-profile" {
          buildInputs = [
            pkgs.xvfb-run
            (pkgs.firefox.override {
              extraPolicies = {
                Extensions.Install = map (x: x.src.outPath) addons;
                ExtensionSettings = {
                  "google@search.mozilla.org" = {installation_mode = "blocked";};
                  "amazondotcom@search.mozilla.org" = {installation_mode = "blocked";};
                  "wikipedia@search.mozilla.org" = {installation_mode = "blocked";};
                  "bing@search.mozilla.org" = {installation_mode = "blocked";};
                };
              };
            })
          ];
        } ''
          HOME=$(mktemp -d)
          export FONTCONFIG_FILE=${pkgs.makeFontsConf {fontDirectories = [pkgs.roboto];}}
          mkdir -p $HOME/.mozilla/firefox/
          mkdir $out
          ln -s $out $HOME/.mozilla/firefox/default
          cat >> $HOME/.mozilla/firefox/profiles.ini<< EOF
          [Profile0]
          Default=1
          IsRelative=1
          Name=default
          Path=default
          EOF

          echo user_pref\(\"browser.region.network.url\", \"\"\)\; > $HOME/.mozilla/firefox/default/user.js

          xvfb-run firefox --screenshot about:blank --headless

          # cat $HOME/.mozilla/firefox/default/extensions.json > $out
          #
        '';
      # extensionsData = "${firefoxData}/extensions.json";

      # addonStartup = pkgs.runCommand "addonStartup.json" {
      #   buildInputs = [
      #     pkgs.mozlz4a
      #     pkgs.jq
      #   ];
      # }
      # ''
      # mozlz4a -d ${firefoxData}/addonStartup.json.lz4 /dev/stdout | jq . > $out
      # '';

      # decrappedAddonStartup = lib.attrsets.updateManyAttrsByPath [
      #   {
      #     path = ["app-builtin" "addons" "google@search.mozilla.org" "enable"];
      #     update = old: false;
      #   }
      # ] addonStartup;

      extensionManifest = e:
        builtins.fromJSON (builtins.readFile (pkgs.runCommand "${e.addonId}-manifest.json" {buildInputs = [pkgs.p7zip];} ''
          7z x -so ${e.src.outPath} manifest.json > $out
        ''));
    in {
      # these come from the HM module
      home.file."${prf}/extension-preferences.json".source = pkgs.emptyFile;
      home.file."${prf}/extension-preferences.json.tmp".source = pkgs.emptyFile;

      home.file."${prf}/extension-settings.json".source = pkgs.emptyFile;
      home.file."${prf}/extension-settings.json.tmp".source = pkgs.emptyFile;

      home.file."${prf}/search.json.mozlz4".source = mozlz4 "search.json.mozlz4" {
        engines = [
          {
            _isAppProvided = true;
            _metaData = {hidden = true;};
            _name = "Google";
            id = "google@search.mozilla.orgdefault";
          }
          {
            _isAppProvided = true;
            _metaData = {hidden = true;};
            _name = "Amazon.com";
            id = "amazondotcom@search.mozilla.orgdefault";
          }
          {
            _isAppProvided = true;
            _metaData = {hidden = true;};
            _name = "Wikipedia (en)";
            id = "wikipedia@search.mozilla.orgdefault";
          }
          {
            _isAppProvided = true;
            _metaData = {hidden = true;};
            _name = "Bing";
            id = "bing@search.mozilla.orgdefault";
          }
          {
            _isAppProvided = true;
            _metaData = {hidden = true;};
            _name = "DuckDuckGo";
            id = "ddg@search.mozilla.orgdefault";
          }
          {
            __searchForm = "https://kagi.com/";
            _definedAliases = [];
            _iconMapObj = {"{\"width\":48,\"height\":48}" = "data:image/vnd.microsoft.icon;base64,AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAAAAAAAAAAGbL/ABiy/w8Zsv9fGbP/vhmz//AZs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//EZs//BGbP/ZRiz/w0Ys/8AAAAAABmy/wAZsv8YGbP/nRmz//QZs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/xlRbP8Zm9v/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///Gbb//xl7rP8ZGxz/GRkZ/xkZGf8ZHR//GUtk/xljiP8ZY4j/GWOI/xljiP8ZY4j/GWOI/xlvmf8ZjMX/Ga31/xm0//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztv//GXSg/xkYGP8ZGRn/GRcW/xk+UP8ZqO//GbT//xm1//8Ztf//GbX//xm1//8ZtP//GbX//xm1//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xm1//8ZhLn/GR4h/xkZGP8ZFxb/GUZb/xmw+P8Zsvz/Gabs/xme4P8ZnuD/Gabs/xmy/f8Ztf//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmk6f8ZOEf/GRcW/xkYGP8ZJCr/GWyV/xlaev8ZOEb/GSkw/xkoMP8ZN0b/GVp6/xmPyv8Zsfz/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xl9rv8ZICT/GRgY/xkZGf8ZGhr/GRcX/xkXF/8ZGBf/GRgX/xkXFv8ZFxb/GSYs/xlpkf8ZrfT/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbD5/xltlv8ZHyP/GRkY/xkZGf8ZGRn/GRgY/xkXFv8ZFxb/GRgY/xkZGf8ZGBf/GRwf/xlli/8ZsPn/GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztf//G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/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8ZY4f/GRkZ/xkZGf8ZGBj/GSIm/xlTcP8ZfK3/GXys/xlWdP8ZIib/GRgY/xkZGf8ZGBj/GWSJ/xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmh5P8ZPU7/GRcV/xkZGf8ZGBj/GRcX/xkcHf8ZHB3/GRcX/xkYGP8ZGRn/GRgX/xk8Tv8ZoOL/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmRzP8ZN0b/GRgX/xkYF/8ZGRn/GRkZ/xkZGf8ZGRn/GRkZ/xkYGP8ZICT/GYG0/xmz//8Zsv3/GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmc3f8ZVnT/GScu/xkZGv8ZGBf/GRgY/xkZGf8ZGRn/GRkZ/xkbHP8ZO0z/GVNv/xmHvf8ZtP//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmv+P8ZldP/GXem/xlli/8ZZoz/GXWj/xk7TP8ZFxb/GRkZ/xkXFv8ZFxb/GW+Z/xm1//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/8Bmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xm0//8Ztf//GbT//xm0//8Ztf//GY3G/xkxPf8ZFxb/GRcW/xkXF/8Zb5n/GbX//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//AZs/++GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8ZtP7/GZbT/xlbe/8ZPU//GTtM/xl/sf8Ztf//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/wBmz/18Zs//zGbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztf//GbL9/xms9f8Zq/P/GbD6/xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//MZs/9kGLL/Dxmz/54Zs//+GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs//+GbP/mxmz/wwZtP8AGrT/GBmz/5sZs//0GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/9Bmz/50atP8YGbT/AAAAAAAYsv8AGLH/DRmz/2QZs//BGbP/8Rmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/8Bmz/74Zs/9fGLT/Dxmz/wAAAAAAwAAAA4AAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAcAAAAM=";};
            _iconURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAURJREFUOE+dk79LAzEcxT+B0goKIih64k9wcxHBzVE66aarY4uHoIMUl8NBK4iLxSq0CP4HRdqlUGdxEx2KIFRBa9VBRBDUFk/Cedgjd95hliTkvZf3fclXAJgFbQdYkuvAQ5AV07W4MPNaBkEsMNEJTAmzoJl+5MojTBrQGoGrXSfaU+D4AubTTnBggWEdPhpOciQE1/uqV8XBwwuMJyzgfdaae38SOknCUJdPCWMr8PT6S5bwegMGdehuh7NtH4GJVag+Q8mA0X4LXL6FqXUY6ITTTR+BLxP64hboUIe3T1g8cJbULKFksFeEZE4NayEKxmyAEO3AZIBbR/Beh7U575+iOLAFKmkQwiLKORxyF/EUcIPbz/pnBvIwloHLKoz0QEcbnN9A+c49SOkgUCdGNyCfgJZw0/2yI+X2nx2ZEjO15W8/wHRJmDJVowAAAABJRU5ErkJggg==";
            _iconUpdateURL = null;
            _loadPath = "[https]kagi.com/kagi.xml";
            _metaData = {
              loadPathHash = "UtVcODv+iDIE7YbKsRgmcuEtoupCFvV7xIfe+lM7oDs=";
              order = 6;
            };
            _name = "Kagi";
            _orderHint = null;
            _telemetryId = null;
            _updateInterval = null;
            _updateURL = null;
            _urls = [
              {
                params = [];
                rels = ["results"];
                template = "https://kagi.com/search?q={searchTerms}";
              }
              {
                params = [];
                rels = ["suggestions"];
                template = "https://kagi.com/api/autosuggest?q={searchTerms}";
                type = "application/x-suggestions+json";
              }
            ];
            description = "A privacy-focused, user-centric search engine.";
            id = "de6311b3-e1df-456e-bc42-73f88ffcd9eb";
          }
          {
            __searchForm = "https://search.nixos.org/";
            _definedAliases = ["!np"];
            # _iconMapObj = {"{\"width\":48,\"height\":48}" = "data:image/vnd.microsoft.icon;base64,AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAAAAAAAAAAGbL/ABiy/w8Zsv9fGbP/vhmz//AZs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//EZs//BGbP/ZRiz/w0Ys/8AAAAAABmy/wAZsv8YGbP/nRmz//QZ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n/xlRbP8Zm9v/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///Gbb//xl7rP8ZGxz/GRkZ/xkZGf8ZHR//GUtk/xljiP8ZY4j/GWOI/xljiP8ZY4j/GWOI/xlvmf8ZjMX/Ga31/xm0//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztv//GXSg/xkYGP8ZGRn/GRcW/xk+UP8ZqO//GbT//xm1//8Ztf//GbX//xm1//8ZtP//GbX//xm1//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xm1//8ZhLn/GR4h/xkZGP8ZFxb/GUZb/xmw+P8Zsvz/Gabs/xme4P8ZnuD/Gabs/xmy/f8Ztf//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmk6f8ZOEf/GRcW/xkYGP8ZJCr/GWyV/xlaev8ZOEb/GSkw/xkoMP8ZN0b/GVp6/xmPyv8Zsfz/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xl9rv8ZICT/GRgY/xkZGf8ZGhr/GRcX/xkXF/8ZGBf/GRgX/xkXFv8ZFxb/GSYs/xlpkf8ZrfT/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbD5/xltlv8ZHyP/GRkY/xkZGf8ZGRn/GRgY/xkXFv8ZFxb/GRgY/xkZGf8ZGBf/GRwf/xlli/8ZsPn/GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztf//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f/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8ZY4f/GRkZ/xkZGf8ZGBj/GSIm/xlTcP8ZfK3/GXys/xlWdP8ZIib/GRgY/xkZGf8ZGBj/GWSJ/xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmh5P8ZPU7/GRcV/xkZGf8ZGBj/GRcX/xkcHf8ZHB3/GRcX/xkYGP8ZGRn/GRgX/xk8Tv8ZoOL/GbT//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmRzP8ZN0b/GRgX/xkYF/8ZGRn/GRkZ/xkZGf8ZGRn/GRkZ/xkYGP8ZICT/GYG0/xmz//8Zsv3/GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmc3f8ZVnT/GScu/xkZGv8ZGBf/GRgY/xkZGf8ZGRn/GRkZ/xkbHP8ZO0z/GVNv/xmHvf8ZtP//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbT//xmv+P8ZldP/GXem/xlli/8ZZoz/GXWj/xk7TP8ZFxb/GRkZ/xkXFv8ZFxb/GW+Z/xm1//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/8Bmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xm0//8Ztf//GbT//xm0//8Ztf//GY3G/xkxPf8ZFxb/GRcW/xkXF/8Zb5n/GbX//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//AZs/++GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8ZtP7/GZbT/xlbe/8ZPU//GTtM/xl/sf8Ztf//GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/wBmz/18Zs//zGbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Ztf//GbL9/xms9f8Zq/P/GbD6/xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//MZs/9kGLL/Dxmz/54Zs//+GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs//+GbP/mxmz/wwZtP8AGrT/GBmz/5sZs//0GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/9Bmz/50atP8YGbT/AAAAAAAYsv8AGLH/DRmz/2QZs//BGbP/8Rmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP//xmz//8Zs///GbP/8Bmz/74Zs/9fGLT/Dxmz/wAAAAAAwAAAA4AAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAcAAAAM=";};
            # _iconURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAURJREFUOE+dk79LAzEcxT+B0goKIih64k9wcxHBzVE66aarY4uHoIMUl8NBK4iLxSq0CP4HRdqlUGdxEx2KIFRBa9VBRBDUFk/Cedgjd95hliTkvZf3fclXAJgFbQdYkuvAQ5AV07W4MPNaBkEsMNEJTAmzoJl+5MojTBrQGoGrXSfaU+D4AubTTnBggWEdPhpOciQE1/uqV8XBwwuMJyzgfdaae38SOknCUJdPCWMr8PT6S5bwegMGdehuh7NtH4GJVag+Q8mA0X4LXL6FqXUY6ITTTR+BLxP64hboUIe3T1g8cJbULKFksFeEZE4NayEKxmyAEO3AZIBbR/Beh7U575+iOLAFKmkQwiLKORxyF/EUcIPbz/pnBvIwloHLKoz0QEcbnN9A+c49SOkgUCdGNyCfgJZw0/2yI+X2nx2ZEjO15W8/wHRJmDJVowAAAABJRU5ErkJggg==";
            _iconURL = "file://${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
            _iconUpdateURL = null;
            # _loadPath = "[https]kagi.com/kagi.xml";
            _metaData = {
              # loadPathHash = "UtVcODv+iDIE7YbKsRgmcuEtoupCFvV7xIfe+lM7oDs=";
              order = 7;
            };
            _name = "nixpkgs";
            _orderHint = null;
            _telemetryId = null;
            _updateInterval = null;
            _updateURL = null;
            _urls = [
              {
                params = [];
                rels = ["results"];
                template = "https://search.nixos.org/packages?query={searchTerms}";
              }
            ];
            description = "nixpkgs";
            id = "229feefe-acd1-47ac-87e1-11373a6608b5";
          }
        ];
        metaData = {
          appDefaultEngineId = "google@search.mozilla.orgdefault";
          channel = "default";
          defaultEngineId = "de6311b3-e1df-456e-bc42-73f88ffcd9eb";
          defaultEngineIdHash = "G2Ce4is1f2X6BdVBEv3KgHQDQPdU4JHhPKU9dJz7uPU=";
          distroID = "nixos";
          experiment = "";
          locale = "en-US";
          region = "IL";
          useSavedOrder = true;
        };
        version = 9;
      };
      home.file."${prf}/search.json.mozlz4.tmp".source = pkgs.emptyFile;

      home.file."${prf}/extensions".source = lib.mkForce "${pkgs.symlinkJoin {
        name = "extensions";
        paths = addons;
      }}/share/mozilla/${extensionPath}";

      home.file."${extstorage}/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;
      };

      home.file."${prf}/crashes".source = pkgs.emptyDirectory;
      home.file."${prf}/datareporting".source = pkgs.emptyDirectory;
      home.file."${prf}/saved-telemetry-pings".source = pkgs.emptyDirectory;

      # home.file."${prf}/addonStartup.json.lz4".source = "${firefoxData}/addonStartup.json.lz4";
      # home.file."${prf}/addonStartup.json.lz4.tmp".source = pkgs.emptyFile;

      home.file."${prf}/addons.json".source = pkgs.emptyFile;
      home.file."${prf}/addons.json.tmp".source = pkgs.emptyFile;

      # home.file."${prf}/extensions.json".source = extensionsData;
      # home.file."${prf}/extensions.json".text = builtins.toJSON {
      #   schemaVersion = 35;
      #   addons =
      #     map (x: {
      #       active = true;
      #       appDisabled = false;
      #       defaultLocale = {};
      #       embedderDisabled = false;
      #       foreignInstall = true;
      #       hidden = false;
      #       id = x.addonId;
      #       location = "app-profile";
      #       manifestVersion = (extensionManifest x).manifest_version;
      #       optionalPermissions = {
      #         permissions = (extensionManifest x).optional_permissions or [];
      #         origins = (extensionManifest x).optional_permissions or [];
      #       };
      #       path = x.src.outPath;
      #       rootURI = "jar:file://${x.src.outPath}!/";
      #       softDisabled = false;
      #       type = "extension";
      #       userDisabled = false;
      #       userPermissions = {
      #         permissions = (extensionManifest x).permissions or [];
      #         origins = (extensionManifest x).permissions or [];
      #       };
      #       version = (extensionManifest x).version;
      #     })
      #     addons;
      # };
      # home.file."${prf}/extensions.json.tmp".source = pkgs.emptyFile;

      # tries to access W_OK it forever
      # home.file."${prf}/prefs.js".source = pkgs.emptyFile;

      # home.file."${prf}/prefs-1.js".source = pkgs.emptyFile;

      programs.firefox = {
        enable = true;
        package = pkgs.firefox-wayland.override {
          extraPolicies = {
            CaptivePortal = false;
            DisableFirefoxStudies = true;
            DisablePocket = true;
            DisableTelemetry = true;
            DisableFirefoxAccounts = true;
            FirefoxHome = {
              Pocket = false;
              Snippets = false;
            };
            UserMessaging = {
              ExtensionRecommendations = false;
              SkipOnboarding = true;
            };
            SearchEngines.Default = "Kagi";
            Extensions.Install = map (x: x.src.outPath) addons;
            ExtensionSettings = {
              #   "google@search.mozilla.org" = {installation_mode = "blocked";};
              #   "amazondotcom@search.mozilla.org" = {installation_mode = "blocked";};
              #   "wikipedia@search.mozilla.org" = {installation_mode = "blocked";};
              #   "bing@search.mozilla.org" = {installation_mode = "blocked";};
              "{3c078156-979c-498b-8990-85f7987dd929}" = {installation_mode = "force_installed";};
            };
          };
        };
        profiles.${profile} = {
          userChrome =
            builtins.readFile ./simplefox.css
            + ''
                        /* hide top tabs */
              #TabsToolbar {
                visibility: collapse !important;
                margin-bottom: 21px !important;
              }
              #sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
                visibility: collapse !important;
              }

              /*
               * Bookmarks toolbar is visible only on new tab page, just like Chrome.
               */

              #main-window #PersonalToolbar {
                visibility: collapse !important;
              }

              #main-window[title^="about:newtab"] #PersonalToolbar,
              #main-window[title^="New Tab"] #PersonalToolbar,
              #main-window[title^="Nightly"] #PersonalToolbar,
              #main-window[title^="Mozilla Firefox"] #PersonalToolbar,
              #main-window[title^="Firefox"] #PersonalToolbar,
              #main-window[title^="新标签页"] #PersonalToolbar,
              #main-window[title^="Customize Firefox"] #PersonalToolbar {
                visibility: visible !important;
              }
            '';
          extensions = with firefox-addons; [
            # ublock-origin
            # clearurls
            # privacy-possum
            # skip-redirect
            # canvasblocker
            i-dont-care-about-cookies
            darkreader
            (firefox-addons.buildFirefoxXpiAddon {
              pname = "sidebery";
              version = "v5.0.0rc4";
              addonId = "{3c078156-979c-498b-8990-85f7987dd929}";
              url = "https://github.com/mbnuqw/sidebery/releases/download/v5.0.0rc4/sidebery-5.0.0rc4.xpi";
              sha256 = "sha256-YsH9yYfGefClRS93dMV/eLMFuoPFKPrx0NL2hIv4dEk=";
              meta = with lib; {
                homepage = "https://github.com/mbnuqw/sidebery";
                description = "Tabs tree and bookmarks in sidebar with advanced containers configuration.";
                license = licenses.mit;
                platforms = platforms.all;
              };
            })
            sidebery
            redirector
            ublock-origin
            keepassxc-browser
            vimium
          ];
          settings = {
            "extensions.activeThemeID" = "{e410fec2-1cbd-4098-9944-e21e708418af}";

            # (try to) hide crap
            "browser.search.hiddenOneOffs" = "Google,Bing,Amazon.com,eBay,Twitter,Wikipedia (en)";
            "browser.newtabpage.activity-stream.showSponsored" = false;
            "browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
            "services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsored" = false;
            "services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
            "browser.newtabpage.activity-stream.default.sites" = "";
            "browser.urlbar.suggest.topsites" = false;
            "browser.newtabpage.activity-stream.feeds.topsites" = false;

            # disable welcome page
            "browser.aboutwelcome.enabled" = false;
            # disable privacy notice
            "datareporting.policy.firstRunURL" = "";
            # "browser.newtabpage.activity-stream.aboutHome.enabled" = false;

            #simplefox
            "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
            "layers.acceleration.force-enabled" = true;
            "gfx.webrender.all" = true;
            "svg.context-properties.content.enabled" = true;

            "signon.rememberSignons" = false;
          };
          # extraConfig = {

          # };
        };
      };
    };
    environment.persistence."/nix/persist".users.tzlil.directories = [
      "${extstorage}/keepassxc-browser@keepassxc.org"
    ];
  }