1{
2 pkgs,
3 lib,
4 config,
5 ...
6}: let
7 engines = import ./engines.nix;
8in {
9 options.mySnippets.firefox-based = {
10 policies = lib.mkOption {
11 type = lib.types.attrs;
12 description = "Policies for Firefox-based browsers";
13 default = {
14 Cookies.Behavior = "reject-foreign";
15 DisableAppUpdate = true;
16 DisableFirefoxStudies = true;
17 DisableMasterPasswordCreation = true;
18 DisablePocket = true;
19 DisableProfileImport = true;
20 DisableSetDesktopBackground = true;
21 DisableTelemetry = true;
22 DisplayBookmarksToolbar = "newtab";
23 #DisableFirefoxAccounts = true;
24 DisableSafeMode = true;
25
26 AutofillAddressEnabled = false;
27 AutofillCreditCardEnabled = false;
28
29 HttpsOnlyMode = "enabled";
30
31 DNSOverHTTPS = {
32 Enabled = true;
33 Fallback = true;
34 };
35
36 DontCheckDefaultBrowser = true;
37
38 EnableTrackingProtection = {
39 Cryptomining = true;
40 Fingerprinting = true;
41 EmailTracking = true;
42 Locked = false;
43 Value = true;
44 };
45
46 EncryptedMediaExtensions = {
47 Enabled = true;
48 Locked = false;
49 };
50
51 FirefoxHome = {
52 Highlights = false;
53 Locked = false;
54 Pocket = false;
55 Search = true;
56 Snippets = false;
57 SponsoredPocket = false;
58 SponsoredTopSites = false;
59 TopSites = false;
60 };
61
62 FirefoxSuggest = {
63 ImproveSuggest = false;
64 Locked = false;
65 SponsoredSuggestions = false;
66 WebSuggestions = false;
67 };
68
69 HardwareAcceleration = true;
70
71 Homepage = {
72 Locked = false;
73 StartPage = "previous-session";
74 };
75
76 NewTabPage = false;
77 NoDefaultBookmarks = true; # Enabling this prevents declaratively setting bookmarks.
78 OfferToSaveLoginsDefault = false;
79 OverrideFirstRunPage = "";
80 OverridePostUpdatePage = "";
81
82 PDFjs = {
83 Enabled = true;
84 EnablePermissions = false;
85 };
86
87 Preferences = {
88 # Do not add the extra "Import Bookmarks" button in the bookmarks interface
89 "browser.bookmarks.addedImportButton" = false;
90
91 # Mark that the user has accepted the data reporting (telemetry) policy
92 "datareporting.policy.dataSubmissionPolicyAccepted" = false;
93
94 # Allow extensions from all scopes (profile, system, etc.) without auto-disabling them
95 "extensions.autoDisableScopes" = 0;
96
97 # Enable VA-API hardware video decoding via FFmpeg (useful on Linux systems)
98 "media.ffmpeg.vaapi.enabled" = true;
99
100 # Enable the VP8/VP9 media data decoder, used in WebRTC and video playback
101 "media.navigator.mediadatadecoder_vpx_enabled" = true;
102
103 # Enable the Remote Data Decoder (RDD) process for FFmpeg to isolate media decoding tasks
104 "media.rdd-ffmpeg.enabled" = true;
105 };
106
107 UserMessaging = {
108 ExtensionRecommendations = false;
109 FeatureRecommendations = false;
110 MoreFromMozilla = false;
111 SkipOnboarding = true;
112 };
113
114 UseSystemPrintDialog = true;
115 };
116 };
117
118 userConfig = lib.mkOption {
119 type = lib.types.attrs;
120 description = "My config for Firefox-based browsers";
121 default = {
122 enable = true;
123
124 inherit (config.mySnippets.firefox-based) policies;
125
126 #nativeMessagingHosts = lib.optionals pkgs.stdenv.isLinux [pkgs.bitwarden-desktop];
127 languagePacks = [
128 "en-GB"
129 "en"
130 "en-US"
131 ];
132
133 # this for some reason doesn't work neither here nor in /modules/nixos/programs/firefox, but i'm keeping it here so i can remember to install those manually again if i ever need to
134 # policies = {
135 # ExtensionSettings = {
136 # "magnolia@12.34" = {
137 # default_area = "menupanel";
138 # install_url = "https://gitflic.ru/project/magnolia1234/bpc_uploads/blob/raw?file=bypass_paywalls_cle# an-latest.xpi";
139 # installation_mode = "normal_installed";
140 # };
141 # "pt-BR@dictionaries.addons.mozilla.org" = {
142 # install_url = "https://addons.mozilla.org/firefox/downloads/latest/corretor/latest.xpi";
143 # installation_mode = "normal_installed";
144 # };
145 # };
146 # };
147
148 profiles = {
149 default = {
150 id = 0;
151 isDefault = true;
152
153 extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
154 consent-o-matic
155 ublock-origin
156 aria2-integration
157 #keepassxc-browser
158 libredirect
159 stylus
160 violentmonkey
161 ublacklist
162 steam-database
163 snowflake
164 sponsorblock
165 karakeep
166 bitwarden
167 ];
168
169 search = {
170 inherit engines;
171 default = "Unduck";
172 force = true;
173
174 order = [
175 "Unduck"
176 "Home Manager Options"
177 "NixOS Wiki"
178 "nixpkgs"
179 "wikipedia"
180 "Wiktionary"
181 ];
182 };
183
184 settings =
185 (import ./betterfox/fastfox.nix)
186 // (import ./betterfox/peskyfox.nix)
187 // (import ./betterfox/securefox.nix)
188 // (import ./betterfox/smoothfox.nix)
189 // {
190 "browser.tabs.groups.enabled" = true;
191 "browser.tabs.groups.smart.enabled" = true;
192 "svg.context-properties.content.enabled" = true;
193 "general.autoScroll" = true;
194 "ui.key.menuAccessKeyFocuses" = false;
195 "browser.search.separatePrivateDefault" = false;
196 "media.videocontrols.picture-in-picture.video-toggle.enabled" = false;
197 "browser.ml.chat.sidebar" = false;
198 };
199
200 userContent = ''
201 @font-face {
202 font-family: "Segoe UI";
203 src: url("${pkgs.roboto-flex}/share/fonts/truetype/RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf");
204 }
205 @font-face {
206 font-family: "system-ui";
207 src: url("${pkgs.roboto-flex}/share/fonts/truetype/RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf");
208 }
209 @font-face {
210 font-family: "-apple-system";
211 src: url("${pkgs.roboto-flex}/share/fonts/truetype/RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf");
212 }
213 @font-face {
214 font-family: "BlinkMacSystemFont";
215 src: url("${pkgs.roboto-flex}/share/fonts/truetype/RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf");
216 }
217 '';
218 };
219 };
220 };
221 };
222 };
223}