nixos configs
1{
2 config,
3 pkgs,
4 lib,
5 inputs,
6 ...
7}:
8{
9 imports = [
10 inputs.zen-browser.homeModules.beta
11 ];
12
13 programs.zen-browser = {
14 enable = true;
15 darwinDefaultsId = "app.zen-browser.zen";
16 nativeMessagingHosts = lib.mkIf (!config.isMacOS) [ pkgs.firefoxpwa ];
17 policies =
18 let
19 mkLockedAttrs = builtins.mapAttrs (
20 _: value: {
21 Value = value;
22 Status = "locked";
23 }
24 );
25 in
26 {
27 AutofillAddressEnabled = true;
28 AutofillCreditCardEnabled = false;
29 DisableAppUpdate = true;
30 DisableFeedbackCommands = true;
31 DisableFirefoxStudies = true;
32 DisablePocket = true;
33 DisableTelemetry = false; # Telemetry is Good, actually
34 DontCheckDefaultBrowser = true;
35 NoDefaultBookmarks = true;
36 OfferToSaveLogins = false;
37 EnableTrackingProtection = {
38 Value = true;
39 Locked = true;
40 Cryptomining = true;
41 Fingerprinting = true;
42 };
43 Preferences = mkLockedAttrs {
44 # Behaviour
45 "browser.aboutConfig.showWarning" = false;
46 "zen.updates.show-update-notification" = false;
47 "zen.welcome-screen.seen" = true;
48 "zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed" = true;
49 "zen.workspaces.continue-where-left-off" = true;
50 "browser.download.useDownloadDir" = false;
51 "browser.ml.linkPreview.enabled" = true;
52 "browser.ml.linkPreview.optin" = true;
53 "browser.tabs.hoverPreview.enabled" = true;
54 "zen.urlbar.behavior" = "normal";
55
56 # Privacy
57 "dom.security.https_only_mode" = true;
58 "network.trr.mode" = 5; # Always use DNS-over-HTTPS over Cloudflare
59
60 # Theme
61 "zen.tabs.show-newtab-vertical" = false;
62 "zen.tabs.vertical.right-side" = true;
63 "zen.view.use-single-toolbar" = false;
64 "zen.urlbar.show-domain-only-in-sidebar" = false;
65 "zen.urlbar.single-toolbar-show-copy-url" = false;
66 "zen.urlbar.replace-newtab" = true;
67 "zen.watermark.enabled" = false;
68 };
69 };
70 languagePacks = [ "en-GB" ];
71 profiles.default = {
72 id = 0;
73 name = "default";
74 isDefault = true;
75
76 extensions.packages = with inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; [
77 bitwarden
78 kagi-search
79
80 # Privacy
81 ublock-origin
82 decentraleyes
83 facebook-container
84 historyblock
85 consent-o-matic
86 clearurls
87
88 # Improvements
89 sponsorblock
90 catppuccin-web-file-icons
91 steam-database
92 unpaywall
93
94 # Fixes
95 don-t-fuck-with-paste
96 ];
97 containersForce = true;
98 containers = {
99 Personal = {
100 color = "purple";
101 icon = "fingerprint";
102 id = 1;
103 };
104 Work = {
105 color = "blue";
106 icon = "briefcase";
107 id = 2;
108 };
109 # Facebook container extension
110 Facebook = {
111 color = "toolbar";
112 icon = "fence";
113 id = 6;
114 };
115 };
116 spacesForce = true;
117 spaces =
118 let
119 containers = config.programs.zen-browser.profiles.default.containers;
120 in
121 {
122 Personal = {
123 id = "c6de089c-410d-4206-961d-ab11f988d40a";
124 position = 1000;
125 container = containers.Personal.id;
126 };
127 Work = {
128 id = "cdd10fab-4fc5-494b-9041-325e5759195b";
129 position = 2000;
130 container = containers.Work.id;
131 };
132 };
133 mods = [
134 "e122b5d9-d385-4bf8-9971-e137809097d0" # No Top Sites
135 "1b88a6d1-d931-45e8-b6c3-bfdca2c7e9d6" # Remove Tab X
136 ];
137 userChrome = ''
138 /* Hide margins */
139 #tabbrowser-tabpanels {
140 padding: 0 0 0 0 !important;
141 }
142 #zen-sidebar-web-panel-wrapper {
143 margin: 0 !important;
144 }
145 * {
146 --zen-border-radius: 0 !important;
147 }
148 '';
149 };
150 };
151
152 xdg.mimeApps =
153 let
154 value = config.programs.zen-browser.package.meta.desktopFileName;
155 associations = builtins.listToAttrs (
156 map
157 (name: {
158 inherit name value;
159 })
160 [
161 "application/x-extension-shtml"
162 "application/x-extension-xhtml"
163 "application/x-extension-html"
164 "application/x-extension-xht"
165 "application/x-extension-htm"
166 "x-scheme-handler/unknown"
167 "x-scheme-handler/mailto"
168 "x-scheme-handler/chrome"
169 "x-scheme-handler/about"
170 "x-scheme-handler/https"
171 "x-scheme-handler/http"
172 "application/xhtml+xml"
173 "application/json"
174 "text/plain"
175 "text/html"
176 ]
177 );
178 in
179 {
180 associations.added = associations;
181 defaultApplications = associations;
182 };
183}