From 09ef721663c7ead400f47880a6aa18f7920f6c34 Mon Sep 17 00:00:00 2001 From: tzlil Date: Wed, 2 Aug 2023 04:58:59 +0300 Subject: firefox crap --- mixins/firefox/default.nix | 179 ++++++++++++++++++++++++++++++++++++++++++ mixins/firefox/userChrome.css | 26 ++++++ 2 files changed, 205 insertions(+) create mode 100644 mixins/firefox/default.nix create mode 100644 mixins/firefox/userChrome.css (limited to 'mixins/firefox') diff --git a/mixins/firefox/default.nix b/mixins/firefox/default.nix new file mode 100644 index 0000000..42bc634 --- /dev/null +++ b/mixins/firefox/default.nix @@ -0,0 +1,179 @@ +let + profile = "default"; +in + { + config, + inputs, + pkgs, + ... + }: { + home-manager.users.tzlil = { + home.file.".mozilla/firefox/default/browser-extension-data/redirector@einaregilsson.com/storage.js".text = builtins.toJSON { + redirects = + map ({ + includePattern, + redirectUrl, + description, + }: { + appliesTo = ["main_frame"]; + inherit description; + disabled = false; + error = null; + exampleResult = ""; + exampleUrl = ""; + excludePattern = ""; + grouped = false; + inherit includePattern; + patternDesc = ""; + patternType = "W"; + processMatches = "noProcessing"; + inherit redirectUrl; + }) [ + { + includePattern = "https://*youtube.com/watch?*v=*"; + redirectUrl = "https://yewtu.be/watch?$2v=$3}"; + description = "invidious"; + } + { + includePattern = "https://*youtube.com/results?*search_query=*"; + redirectUrl = "https://yewtu.be/search?$2q=$3"; + description = "invidious search"; + } + ]; + enableNotifications = false; + }; + programs.firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPolicies = { + OverrideFirstRunPage = ""; + Extensions = { + Install = map (x: x.src.outPath) config.home-manager.users.tzlil.programs.firefox.profiles."default".extensions; + Uninstall = [ + "google@search.mozilla.org" + "amazondotcom@search.mozilla.org" + "wikipedia@search.mozilla.org" + "bing@search.mozilla.org" + ]; + }; + SearchEngines.Remove = [ + "Amazon" + "Bing" + "Google" + "Twitter" + "Wikipedia" + "Yahoo" + ]; + }; + }; + profiles."${profile}" = { + search = { + default = "DuckDuckGo"; + force = true; + }; + userChrome = builtins.readFile ./userChrome.css; + extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ + # privacy crap + ublock-origin + clearurls + darkreader + privacy-possum + smart-referer + # localcdn + canvasblocker + history-cleaner + + # usability crap + vimium + # tree-style-tab + sidebery + redirector + demodal + kristofferhagen-nord-theme + # new-tab-override + + # misc + snowflake + # (flagfox.overrideAttrs {meta.license.free = true;}) + ]; + settings = { + # for custom browser style + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + + "browser.newtabpage.pinned" = [ + {url = "https://tzlil.net";} + ]; + "browser.startup.homepage" = "https://lobste.rs"; + + "extensions.activeThemeID" = "{e410fec2-1cbd-4098-9944-e21e708418af}"; + + "browser.toolbars.bookmarks.visibility" = "always"; + "browser.uidensity" = 1; + "browser.aboutConfig.showWarning" = false; + "browser.shell.checkDefaultBrowser" = false; + + "browser.search.hiddenOneOffs" = "Google,Bing,Amazon.com,eBay,Twitter,Wikipedia (en)"; + + "browser.download.dir" = config.home-manager.users.tzlil.xdg.userDirs.download; + # privacy crap + "app.normandy.enabled" = false; + "app.shield.optoutstudies.enabled" = false; + "app.update.auto" = false; + "beacon.enabled" = false; + "breakpad.reportURL" = ""; + "browser.tabs.inTitlebar" = 0; + "browser.compactmode.show" = true; + "browser.contentblocking.category" = "strict"; + "browser.crashReports.unsubmittedCheck.enabled" = false; + "browser.discovery.enabled" = false; + "browser.newtab.preload" = false; + "browser.newtabpage.activity-stream.enabled" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "browser.ping-centre.telemetry" = false; + "browser.pocket.enabled" = false; + "browser.safebrowsing.malware.enabled" = true; + "browser.safebrowsing.phishing.enabled" = true; + "browser.send_pings" = false; + "browser.tabs.crashReporting.sendReport" = false; + "signon.autofillForms" = false; + "media.autoplay.default" = 2; + "device.sensors.enabled" = false; + "datareporting.healthreport.service.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "datareporting.policy.dataSubmissionEnabled" = false; + "dom.security.https_only_mode" = true; + "dom.battery.enabled" = false; + "experiments.enabled" = false; + "experiments.supported" = false; + "extensions.pocket.enabled" = false; + "extensions.shield-recipe-client.enabled" = false; + "network.dns.blockDotOnion" = true; + "network.stricttransportsecurity.preloadlist" = true; + "privacy.donottrackheader.enabled" = true; + "privacy.firstparty.isolate" = true; + "privacy.trackingprotection.cryptomining.enabled" = true; + "privacy.trackingprotection.enabled" = true; + "privacy.trackingprotection.fingerprinting.enabled" = true; + "privacy.trackingprotection.pbmode.enabled" = true; + "privacy.trackingprotection.socialtracking.enabled" = true; + "security.insecure_password.ui.enabled" = true; + "security.ssl.errorReporting.automatic" = false; + "services.sync.engine.addons" = false; + "services.sync.addons.ignoreUserEnabledChanges" = true; + "toolkit.telemetry.archive.enabled" = false; + "toolkit.telemetry.bhrPing.enabled" = false; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.firstShutdownPing.enabled" = false; + "toolkit.telemetry.hybridContent.enabled" = false; + "toolkit.telemetry.newProfilePing.enabled" = false; + "toolkit.telemetry.reportingpolicy.firstRun" = false; + "toolkit.telemetry.server" = ""; + "toolkit.telemetry.shutdownPingSender.enabled" = false; + "toolkit.telemetry.unified" = false; + "toolkit.telemetry.updatePing.enabled" = false; + }; + }; + }; + }; + } diff --git a/mixins/firefox/userChrome.css b/mixins/firefox/userChrome.css new file mode 100644 index 0000000..c7ad88b --- /dev/null +++ b/mixins/firefox/userChrome.css @@ -0,0 +1,26 @@ +/* hide top tabs */ +#TabsToolbar { + visibility: collapse !important; + margin-bottom: 21px !important; +} +#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header { + visibility: collapse !important; +} + +/* + * Bookmarks toolbar is visible only on new tab page, just like Chrome. + */ + +#main-window #PersonalToolbar { + visibility: collapse !important; +} + +#main-window[title^="about:newtab"] #PersonalToolbar, +#main-window[title^="New Tab"] #PersonalToolbar, +#main-window[title^="Nightly"] #PersonalToolbar, +#main-window[title^="Mozilla Firefox"] #PersonalToolbar, +#main-window[title^="Firefox"] #PersonalToolbar, +#main-window[title^="新标签页"] #PersonalToolbar, +#main-window[title^="Customize Firefox"] #PersonalToolbar { + visibility: visible !important; +} \ No newline at end of file -- cgit 1.4.1