zen: overhaul configuration

Declaratively configure plugin installation and configuration.

Use my own self-hosted sync server.
This commit is contained in:
2026-03-21 13:29:40 -04:00
parent 543930921f
commit 1fc00ab1a3
6 changed files with 415 additions and 2 deletions

View File

@@ -0,0 +1,164 @@
# Dark Reader extension settings
# Addon ID: addon@darkreader.org
{ lib }:
let
defaultTheme = {
mode = 1;
brightness = 100;
contrast = 100;
grayscale = 0;
sepia = 0;
useFont = false;
fontFamily = "Open Sans";
textStroke = 0;
engine = "dynamicTheme";
stylesheet = "";
darkSchemeBackgroundColor = "#181a1b";
darkSchemeTextColor = "#e8e6e3";
lightSchemeBackgroundColor = "#dcdad7";
lightSchemeTextColor = "#181a1b";
scrollbarColor = "";
selectionColor = "auto";
styleSystemControls = false;
lightColorScheme = "Default";
darkColorScheme = "Default";
immediateModify = false;
};
mkCustomTheme =
{
url,
engine ? defaultTheme.engine,
builtIn ? false,
}:
{
inherit url;
theme = defaultTheme // {
inherit engine;
};
}
// lib.optionalAttrs builtIn { inherit builtIn; };
in
{
force = true;
settings = {
enabled = true;
fetchNews = true;
syncSettings = true;
syncSitesFixes = false;
changeBrowserTheme = false;
enabledByDefault = false;
enableForPDF = true;
enableForProtectedPages = false;
enableContextMenus = false;
detectDarkTheme = true;
previewNewDesign = false;
previewNewestDesign = false;
theme = defaultTheme;
enabledFor = [
"search.nixos.org"
"quizlet.com"
"claude.ai"
];
disabledFor = [
"cinny.envs.net"
"element.envs.net"
"mail.proton.me"
"mail.google.com"
"www.gardling.com"
"projects.fivethirtyeight.com"
"secure.bankofamerica.com"
"billpay-ui.bankofamerica.com"
"plus.pearson.com"
"immich.gardling.com"
"huggingface.co"
"session.masteringphysics.com"
"brainly.com"
"www.270towin.com"
"phet.colorado.edu"
"8042-1.portal.athenahealth.com"
"torrent.gardling.com"
"nssb-p.adm.fit.edu"
"mail.openbenchmarking.org"
"moneroocean.stream"
"app.diagrams.net"
"books.gw-project.org"
"chat.deepseek.com"
"n21.ultipro.com"
"www.egaroucid.nyanyan.dev"
"bitmagnet.gardling.com"
"frame.work"
"www.altcancer.net"
"jenkins.jpenilla.xyz"
"soulseek.gardling.com"
"discord.com"
"www.lufthansa.com"
"surveys.hyundaicx.com"
"www.apple.com"
"docs.google.com"
"marcuspork.com"
"en.akinator.com"
"www.reddit.com"
"terra.layoutit.com"
"www.ebay.com"
"www.nytimes.com"
"app.electricitymaps.com"
"www.revoy.com"
"kagi.com"
"www.bhphotovideo.com"
"survey.stackoverflow.co"
"www.google.com"
"en.wikipedia.org"
"workforcenow.adp.com"
"app.element.io"
"www.desmos.com"
"en.wiktionary.org"
"dariandean0.github.io"
];
customThemes = [
(mkCustomTheme {
url = [ "*.officeapps.live.com" ];
engine = "cssFilter";
builtIn = true;
})
(mkCustomTheme {
url = [ "*.sharepoint.com" ];
engine = "cssFilter";
builtIn = true;
})
(mkCustomTheme {
url = [ "docs.google.com" ];
engine = "cssFilter";
builtIn = true;
})
(mkCustomTheme {
url = [ "onedrive.live.com" ];
engine = "cssFilter";
builtIn = true;
})
(mkCustomTheme {
url = [ "huggingface.co" ];
engine = "svgFilter";
})
(mkCustomTheme {
url = [ "www.last.fm" ];
engine = "svgFilter";
})
];
automation = {
enabled = false;
mode = "";
behavior = "OnOff";
};
time = {
activation = "18:00";
deactivation = "9:00";
};
};
}

View File

@@ -0,0 +1,75 @@
{
pkgs,
lib,
inputs,
config,
...
}:
let
firefox-addons = inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system};
buildFirefoxXpiAddon =
inputs.firefox-addons.lib.${pkgs.stdenv.hostPlatform.system}.buildFirefoxXpiAddon;
hacker-smacker = buildFirefoxXpiAddon {
pname = "hacker-smacker";
version = "2.2";
addonId = "jid1-eo0mcXLTqCkaWA@jetpack";
url = "https://addons.mozilla.org/firefox/downloads/file/4715262/hacker_smacker-2.2.xpi";
sha256 = "d28f0597d5c4bae5db712b4875f4104120f7e55e5ea769c44d70996be31cc0d1";
meta = with lib; {
homepage = "https://www.hackersmacker.org";
description = "Highlight (friend) and filter (foe) individual authors on Hacker News";
license = licenses.mit;
platforms = platforms.all;
};
};
ublockSettings = import ./ublock.nix { inherit lib; };
darkReaderSettings = import ./dark-reader.nix { inherit lib; };
in
{
programs.zen-browser = {
enable = true;
profiles.default = {
isDefault = true;
extensions = {
force = true;
packages =
(with firefox-addons; [
bitwarden
buster-captcha-solver
consent-o-matic
darkreader
fastforwardteam
localcdn
refined-github
return-youtube-dislikes
search-by-image # reverse image search
ruffle_rs
snowflake
steam-database
ublock-origin
])
++ [ hacker-smacker ];
settings = {
"uBlock0@raymondhill.net" = ublockSettings;
"addon@darkreader.org" = darkReaderSettings;
};
};
settings = {
"identity.sync.tokenserver.uri" = "https://firefox-sync.sigkill.computer/1.0/sync/1.5";
# auto-enable extensions on install
"extensions.autoDisableScopes" = 0;
};
};
};
# Zen ignores XDG and hardcodes ~/.zen — symlink to module-managed path
home.file.".zen".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.configHome}/zen";
home.sessionVariables.BROWSER = "zen";
}

View File

@@ -0,0 +1,143 @@
# uBlock Origin extension settings
# Addon ID: uBlock0@raymondhill.net
{ lib }:
{
force = true;
settings = {
userSettings = {
cloudStorageEnabled = true;
externalLists = builtins.concatStringsSep "\n" [
"https://abp.oisd.nl/"
"https://filters.adtidy.org/extension/ublock/filters/3.txt"
"https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt"
"https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt"
"https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt"
];
importedLists = [
"https://abp.oisd.nl/"
"https://filters.adtidy.org/extension/ublock/filters/3.txt"
"https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt"
"https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt"
"https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt"
];
popupPanelSections = 15;
prefetchingDisabled = false;
};
selectedFilterLists = [
"user-filters"
"ublock-filters"
"ublock-badware"
"ublock-privacy"
"ublock-quick-fixes"
"ublock-unbreak"
"easylist"
"adguard-generic"
"adguard-mobile"
"easyprivacy"
"adguard-spyware-url"
"block-lan"
"urlhaus-1"
"curben-phishing"
"plowe-0"
"dpollock-0"
"fanboy-cookiemonster"
"ublock-cookies-easylist"
"adguard-cookies"
"ublock-cookies-adguard"
"fanboy-social"
"adguard-social"
"fanboy-thirdparty_social"
"easylist-chat"
"easylist-newsletters"
"easylist-notifications"
"easylist-annoyances"
"adguard-mobile-app-banners"
"adguard-other-annoyances"
"adguard-popup-overlays"
"adguard-widgets"
"ublock-annoyances"
"SWE-1"
"https://filters.adtidy.org/extension/ublock/filters/3.txt"
"https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt"
"https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt"
"https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt"
"https://abp.oisd.nl/"
];
whitelist = [
"chrome-extension-scheme"
"moz-extension-scheme"
];
dynamicFilteringString = builtins.concatStringsSep "\n" [
"behind-the-scene * * noop"
"behind-the-scene * inline-script noop"
"behind-the-scene * 1p-script noop"
"behind-the-scene * 3p-script noop"
"behind-the-scene * 3p-frame noop"
"behind-the-scene * image noop"
"behind-the-scene * 3p noop"
];
hostnameSwitchesString = builtins.concatStringsSep "\n" [
"no-large-media: behind-the-scene false"
"no-csp-reports: * true"
"no-scripting: arstechnica.com true"
"no-scripting: www.phoronix.com true"
"no-scripting: www.theatlantic.com true"
"no-scripting: wccftech.com true"
"no-remote-fonts: www.theverge.com true"
"no-scripting: www.theverge.com true"
"no-scripting: gamersnexus.net true"
];
userFilters = builtins.concatStringsSep "\n" [
# Annoying fonts warning because of localCDN
"docs.google.com##.jfk-butterBar-shown.jfk-butterBar-info.jfk-butterBar"
# remove phoronix premium ad
"www.phoronix.com##aside:nth-of-type(3)"
"www.phoronix.com##aside.widget:nth-of-type(4)"
# Remove instagram login screen
"www.instagram.com##.x1nhvcw1.x1oa3qoh.x1qjc9v5.xqjyukv.xdt5ytf.x2lah0s.x1c4vz4f.x1odjw0f.xw2csxc.x1n2onr6.xo71vjh.x5pf9jr.x13lgxp2.x168nmei.x78zum5.xjbqb8w.x9f619"
"www.instagram.com##.xl56j7k.x1iyjqo2.xdt5ytf.x78zum5.x9f619.x1qjc9v5"
"www.instagram.com##.x1jfb8zj.x1qrby5j.x1n2onr6.x7ja8zs.x1t2pt76.x1lytzrv.xedcshv.xarpa2k.x3igimt.x12ejxvf.xaigb6o.x1beo9mf.x1h91t0o.x4k7w5x.x1uvtmcs"
"www.instagram.com##.x1h0vfkc.x13vifvy.xixxii4.x17qophe.xds687c.x1ey2m1c"
"www.instagram.com##.x1n2onr6.xg6iff7.xippug5.xdt5ytf.x78zum5"
"www.instagram.com##.xzkaem6.x1n2onr6 > .xjx87ck.x1yqm8si.xfk6m8.xh8yej3.x13vifvy.x1rohswg.xixxii4.x1odjw0f.xw2csxc.x17qophe.x5yr21d.x1pq812k.x1ja2u2z.x9f619"
# remove github dashboard copilot stuff
"github.com##copilot-dashboard-entrypoint"
"github.com##.hide-md.hide-sm.AppHeader-CopilotChat > react-partial-anchor"
"github.com##react-partial-anchor > .AppHeader-buttonLeft.AppHeader-button.Button--medium.Button--secondary.Button--iconOnly.Button"
"github.com##.Button.Button--medium.Button--secondary.AppHeader-button--dropdown.AppHeader-buttonRight.AppHeader-button"
"github.com##.tooltipped-sw.tooltipped.AppHeader-buttonRight.color-fg-muted.AppHeader-button.Button--medium.Button--secondary.Button--iconOnly.Button"
# github sidebar stuff
''github.com##.rounded-2.p-3.color-border-default.border.\<color-bg-default.dashboard-changelog.mb-3''
"github.com##.mb-5.feed-right-sidebar"
"app.howthemarketworks.com##div.reveal-overlay:nth-of-type(8)"
# github copilot chat
"github.com##.CopilotChatInputPartial-module__inputSection--UWMD6"
"github.com##.CopilotChatInputPartial-module__inputContainer--EE6LJ"
# reddit
''www.reddit.com##.font-normal > .mt-0.list-none.relative > .s\:rounded-2.bg-transparent.-outline-offset-1.py-2xs.cursor-pointer.hover\:no-underline.hover\:bg-neutral-background-hover.hover\:text-secondary-hover.text-secondary.gap-\[0\.5rem\].px-md.relative.justify-between.flex''
"www.quora.com##.qu-bg--raised.qu-mb--small.qu-boxShadow--small.qu-borderColor--raised.qu-borderAll.dom_annotate_question_answer_item_0.q-box > div > div > div > div > div.q-box"
"discord.com##.contentCollapsedWrapper__5f897"
"www.statista.com###pdfpremiumArrowModal > .vueModal__overlay"
# The AI summary BS
''www.reddit.com##.px-md.pb-\[22px\].pt-md.mt-md.rounded-4.bg-neutral-background-weak.xs\:block.hidden''
"www.sciencedirect.com##.gXjxP.sc-fHSyaj"
];
};
}