summaryrefslogtreecommitdiff
path: root/modules/programs/firefox/default.nix
blob: dce7d0b9d8e8ecf959e6b64df4673a2e6a88e308 (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
{ config, lib, pkgs, ... }:

let

  extraPrefs = ''//

// Automatically click cookiebanners although uBlock Origin might block them
lockPref("cookiebanners.bannerClicking.enabled", true);
lockPref("cookiebanners.service.mode", 2);
lockPref("cookiebanners.service.mode.privateBrowsing", 2);

// DNT although PrivacyBadger from policy handles this
lockPref("privacy.donottrackheader.enabled", true);
lockPref("privacy.donottrackheader.value", 1);

// New sidebar
lockPref("sidebar.revamp", true);
lockPref("sidebar.verticalTabs", true);
lockPref("sidebar.visibility", "always-show");
lockPref("sidebar.main.tools", "history,bookmarks");

//'';

  userChrome = ''
/* sidebar hack to flip contents the way i want them (arrows on the left) */
#nav-bar-customization-target {
  flex-direction: row-reverse;
}

/* remove broken padding from sidebar hack */
#unified-extensions-button {
  padding-left: 0 !important;
}

/* remove padding beside search bar */
toolbarspring {
  display: none !important;
}

/* remove overflow menu and everything in it */
#nav-bar-overflow-button,
#firefox-view-button,
#alltabs-button {
  visibility: collapse;
}
'';

  my-firefox = (pkgs.firefox.override {
    extraPrefs = extraPrefs;
  });

in
{
  config = lib.mkIf config.desktop.enable {

    home-manager.users.${config.user} = {
      programs.firefox = {

        enable = true;
        package = my-firefox;

        # import configuration
        policies = import ./policies.nix;

        # create profile for me :3
        profiles.${config.user} = {
          search = {
            force = true;
            default = "DuckDuckGo";
            engines = {
              "Google".metaData.hidden = true;
              "Bing".metaData.hidden = true;
              "Amazon.com".metaData.hidden = true;
              "eBay".metaData.hidden = true;
              "Twitter".metaData.hidden = true;
            };
          };

          # firefox doesnt make styling the toolbar easy using about:config
          # since its just a massive json string. so i did it here in css.
          userChrome = userChrome;
        }; # end profile

      };
    };

  };
}