summaryrefslogtreecommitdiff
path: root/home/nix/programs/firefox.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home/nix/programs/firefox.nix')
-rw-r--r--home/nix/programs/firefox.nix111
1 files changed, 78 insertions, 33 deletions
diff --git a/home/nix/programs/firefox.nix b/home/nix/programs/firefox.nix
index 61f4c17..e1ebe92 100644
--- a/home/nix/programs/firefox.nix
+++ b/home/nix/programs/firefox.nix
@@ -1,5 +1,7 @@
{ pkgs, nixgl, ... }:
let
+ # quick variables to specify
+ # locked true/false
lock-false = {
Value = false;
Status = "locked";
@@ -8,39 +10,60 @@
Value = true;
Status = "locked";
};
+
+ # path to nixGL binary (needed for webGL)
nixGL = "${nixgl.packages.${pkgs.system}.nixGLIntel}/bin/nixGLIntel";
- my-firefox = (pkgs.firefox.override {
- 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);
+ # modify firefox base package AND wrapper
+ # - set user prefs
+ # - fix webGL
+ my-firefox = (pkgs.firefox.override { # start wrapper override
- // DNT although PrivacyBadger from policy handles this
- lockPref("privacy.donottrackheader.enabled", true);
- lockPref("privacy.donottrackheader.value", 1);
+ # file: mozilla.cfg
+ # modifies user prefs that firefox would normally not
+ # let me hardcode. i want to hardcode them.
+ extraPrefs = ''//
- // New sidebar
- lockPref("sidebar.revamp", true);
- lockPref("sidebar.verticalTabs", true);
- lockPref("sidebar.visibility", "always-show");
- lockPref("sidebar.main.tools", "");
+// 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);
- //
- '';
- }).overrideAttrs (old: {
+// 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");
+
+//'';
+
+ }) # end wrapper override
+ .overrideAttrs (old: { # start base package override
+
+ # modify run (build) command for firefox so that
+ # we can always have nixGL be called first before firefox
+ # ... this fixes webGL on GNU/Guix. this is likely not needed if you
+ # are just running nixOS
buildCommand = old.buildCommand + ''
sed -i "s#firefox-wrapped\"#firefox-wrapped\" \"${nixGL}\"#1" "$out/bin/firefox"
'';
- });
+ }); # end base package override
in
{
programs.firefox = {
+
+ # enable firefox and
+ # pass in our custom (modified) package from above
enable = true;
package = my-firefox;
+ # set firefox policies that i want
+ # (all that can be modified by firefox policy templates)
+ # see: https://mozilla.github.io/policy-templates/
policies = {
EnableTrackingProtection = {
Value = true;
@@ -208,12 +231,19 @@
install_url = "https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/latest.xpi";
installation_mode = "force_installed";
};
+ # Redirector
+ "redirector@einaregilsson.com" = {
+ install_url = "https://addons.mozilla.org/firefox/downloads/latest/redirector/latest.xpi";
+ installation_mode = "force_installed";
+ };
};
# about:config Preferences
+ # ... set policies that cannot be set using policies.json directly
Preferences = {
- # theme
+ # allow userChrom.css
"toolkit.legacyUserProfileCustomizations.stylesheets" = lock-true;
+ # dark theme
"extensions.activeThemeID" = {
Value = "firefox-compact-dark@mozilla.org";
Status = "locked";
@@ -224,12 +254,12 @@
};
# homepage
"browser.startup.homepage" = {
- Value = " about:home";
+ Value = "about:home";
Status = "locked";
};
"browser.newtabpage.enabed" = lock-true;
"browser.newtabpage.url" = {
- Value = " about:home";
+ Value = "about:home";
Status = "locked";
};
# autofill
@@ -270,6 +300,7 @@
"dom.webgpu.enabled" = lock-true;
"media.eme.enabled" = lock-true;
# user messaging
+ # ... disable shit that is annoying
"browser.newtabpage.activity-stream.feeds.section.topstories" = lock-false;
"browser.newtabpage.activity-stream.feeds.snippets" = lock-false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = lock-false;
@@ -313,6 +344,7 @@
};
};
+ # create profile for me :3
profiles = {
"freya" = {
search = {
@@ -326,18 +358,31 @@
"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 = ''
- #sidebar-header { display:none !important; }
- #sidebar-search-container { display:none !important; }
- #firefox-view-button {
- visibility: collapse;
- }
- #alltabs-button {
- visibility: collapse;
- }
- #tabbrowser-tabs {
- border-inline-start: none !important;
- }
+/* 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;
+}
'';
};
};