{ pkgs, config, lib, inputs, ... }: let cfg = config.xyno.firefox; in { options.xyno.firefox.enable = lib.mkOption { default = false; }; options.xyno.firefox.package = lib.mkOption { type = lib.types.package; default = inputs.zen-browser.packages.${pkgs.system}.default; }; config = lib.mkIf cfg.enable { programs.firefox = { enable = true; package = cfg.package; languagePacks = [ "en-US" "de" ]; preferences = { "widget.use-xdg-desktop-portal.file-picker" = 1; "font.default.x-western" = "sans-serif"; "font.name.sans-serif.x-western" = "Source Sans 3"; "font.name.monospace.x-western" = "JetBrainsMono Nerd Font"; "font.size.vaiable.x-western" = "14"; "network.proxy.allow_hijacking_localhost" = true; "browser.newtabpage.pinned" = builtins.toJSON [ # won't ever see that but whatever { url = "https://mastodon.catgirl.cloud"; label = "fedi"; } { url = "https://youtube.com"; label = "YouTube"; } { url = "https://tagesschau.de"; label = "Tagesschau"; } { url = "https://heise.de"; label = "heise"; } ]; # things ripped from https://github.com/yokoffing/Betterfox/blob/main/Fastfox.js "media.memory_cache_max_size" = 65536; "media.cache_readahead_limit" = 7200; "media.cache_resume_threshold" = 3600; "network.http.max-connections" = 1000; "network.http.max-persistent-connections-per-server" = 10; "network.http.max-urgent-start-excessive-connections-per-host" = 5; "network.ssl_tokens_cache_capacity" = 10240; }; policies = { # Updates & Background Services AppAutoUpdate = false; BackgroundAppUpdate = false; DisableSetDesktopBackground = true; DisablePocket = true; DisableTelemetry = true; DisableFirefoxAccounts = true; DontCheckDefaultBrowser = true; PasswordManagerEnabled = false; Proxy = { # set up ssh socks proxy but don't enable it Mode = "none"; Locked = false; SOCKSProxy = "[::1]:12345"; SOCKSVersion = 5; UseProxyForDns = true; }; SkipTermsOfUse = true; ExtensionSettings = let moz = name: "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi"; in { "uBlock0@raymondhill.net" = { default_area = "menupanel"; install_url = moz "ublock-origin"; installation_mode = "force_installed"; private_browsing = true; }; "vimium-c@gdh1995.cn" = { default_area = "navbar"; install_url = moz "vimium-c"; installation_mode = "force_installed"; private_browsing = true; }; "keepassxc-browser@keepassxc.org" = { default_area = "navbar"; install_url = moz "keepassxc-browser"; installation_mode = "force_installed"; private_browsing = true; }; "{aecec67f-0d10-4fa7-b7c7-609a2db280cf}" = { default_area = "menupanel"; install_url = moz "violentmonkey"; installation_mode = "force_installed"; private_browsing = true; }; "sponsorBlocker@ajay.app" = { default_area = "menupanel"; install_url = moz "sponsorblock"; installation_mode = "force_installed"; private_browsing = true; }; "clipper@obsidian.md" = { default_area = "navbar"; install_url = moz "web-clipper-obsidian"; installation_mode = "force_installed"; private_browsing = true; }; }; }; }; profiles.default = { bookmarks.settings = [ { name = "wikipedia"; tags = [ "wiki" ]; keyword = "wiki"; url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go"; } { name = "mastodon.catgirl.cloud"; tags = [ "fedi" ]; keyword = "fedi"; url = "https://mastodon.catgirl.cloud"; } { name = "YouTube"; tags = [ "yt" ]; keyword = "yt"; url = "https://youtube.com"; } { name = "tagesschau.de"; tags = [ "news" ]; keyword = "tagesschau"; url = "https://tagesschau.de"; } { name = "heise.de"; tags = [ "news" ]; keyword = "heise"; url = "https://heise.de"; } "seperator" { name = "Nix sites"; toolbar = true; bookmarks = [ { name = "homepage"; url = "https://nixos.org/"; } { name = "wiki"; tags = [ "wiki" "nix" ]; url = "https://wiki.nixos.org/"; } ]; } ]; extensions.settings = { "uBlock0@raymondhill.net" = { }; }; search = { force = true; default = "DuckDuckGo"; privateDefault = "DuckDuckGo"; engines = { "Nix Packages" = { urls = [ { template = "https://search.nixos.org/packages"; params = [ { name = "channel"; value = "unstable"; } { name = "query"; value = "{searchTerms}"; } ]; } ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@np" ]; }; "Nix Options" = { urls = [ { template = "https://search.nixos.org/options"; params = [ { name = "channel"; value = "unstable"; } { name = "query"; value = "{searchTerms}"; } ]; } ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@no" ]; }; "NixOS Wiki" = { urls = [ { template = "https://wiki.nixos.org/w/index.php"; params = [ { name = "search"; value = "{searchTerms}"; } ]; } ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@nw" ]; }; }; }; }; }; }