about summary refs log tree commit diff stats
path: root/hm/soispha/conf/firefox/config/policies/default.nix
blob: 401d877821c627c4cb41339bd697463e85f51931 (plain) (blame)
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
{
  config,
  extensions,
  ...
}: let
  locals = [
    "en-CA"
    "de"
    "sv-SE"
  ];
  mkAllowedExtension = extension: {
    name = extension.addonId;
    value = {
      installation_mode = "normal_installed";
      updates_disabled = true;
      inherit (extension) default_area;
      install_url = "file://${builtins.fetchurl {
        inherit
          (extension)
          url
          sha256
          ;
      }}";
    };
  };
  allowedExtensions =
    builtins.listToAttrs
    (builtins.map mkAllowedExtension (builtins.attrValues
        extensions));

  mkBlockedExtension = id: {
    name = id;
    value = {
      install_mode = "blocked";
    };
  };
  blockedExtensions = builtins.listToAttrs (builtins.map mkBlockedExtension [
    # these are the default search engines
    "addons-search-detection@mozilla.com"
    "amazon@search.mozilla.org"
    "bing@search.mozilla.org"
    "ddg@search.mozilla.org"
    "google@search.mozilla.org"
    "wikipedia@search.mozilla.org"
  ]);

  language_packs = builtins.listToAttrs (builtins.map
    (
      lang: {
        name = "langpack-${lang}@firefox.mozilla.org";
        value = {
          installation_mode = "normal_installed";
          install_url = "https://releases.mozilla.org/pub/firefox/releases/${config.soispha.firefox.package_version}/linux-x86_64/xpi/${lang}.xpi";
        };
      }
    )
    locals);
in {
  # NOTE: See https://mozilla.github.io/policy-templates for documentation <2023-10-21>

  # NixOS manages this already
  DisableAppUpdate = true;

  DisableFirefoxAccounts = true;
  DisableFirefoxScreenshots = true;

  # KeepassXC does this for me
  DisableMasterPasswordCreation = true;

  # I use a self-hosted services for that
  DisablePocket = true;

  # I don't want to lose my data
  DisableProfileRefresh = true;

  DisplayBookmarksToolbar = "newtab";
  DisplayMenuBar = "default-off";

  DNSOverHTTPS = {
    Enabled = true;
    Locked = false;
  };
  # The concept of a "default browser" does not apply to my NixOS config
  DontCheckDefaultBrowser = true;

  EnableTrackingProtection = {
    Value = true;
    Locked = false;
    Cryptomining = true;
    Fingerprinting = true;
    EmailTracking = true;
  };

  EncryptedMediaExtensions = {
    # I want a _free_ config (and I can always just run another browser)
    Enabled = false;
    Locked = true;
  };

  ExtensionSettings =
    {
      "*" = {
        blocked_install_message = ''
          You can't install a extension manually,
          please specify it in your NixOS configuration
        '';
        installation_mode = "blocked";
      };
    }
    // allowedExtensions
    // blockedExtensions
    // language_packs;
  ExtensionUpdate = false;

  # TODO: Add handlers for the default file types <2023-10-21>
  # Handlers = {
  # };

  HardwareAcceleration = true;

  InstallAddonsPermission = {
    Allowed = [];
    Default = false;
  };

  # KeepassXC and such things
  OfferToSaveLogins = false;
  PasswordManagerEnabled = false;

  PDFjs = {
    Enabled = true;
    # Don't honor documents right to be un-copy-able
    EnablePermissions = false;
  };

  SearchBar = "unified";
  RequestedLocales = locals;
}