{ lib, pkgs, config, ... }: with lib; let cfg = config.programs.firefox; in { options.programs.firefox.forcePrivateBrowsing = mkOption { type = lib.types.bool; default = true; example = true; description = "Whether to force private browsing."; }; config = { programs.firefox = { enable = true; languagePacks = [ "en-US" "de" ]; # ---- POLICIES ---- # Check about:policies#documentation for options. policies = { Authentication = { "SPNEGO" = [ "upb.de" "uni-paderborn.de" "cs.uni-paderborn.de" ]; "NTLM" = [ "upb.de" "uni-paderborn.de" "cs.uni-paderborn.de" ]; }; BlockAboutAddons = false; BlockAboutConfig = false; BlockAboutProfiles = false; DisableTelemetry = true; DisableFirefoxStudies = true; EnableTrackingProtection = { Value = true; Locked = true; Cryptomining = true; Fingerprinting = true; }; DisablePocket = true; DisableFirefoxAccounts = true; DisableAccounts = true; DisableFirefoxScreenshots = true; OverrideFirstRunPage = ""; OverridePostUpdatePage = ""; AppAutoUpdate = false; DontCheckDefaultBrowser = true; PrimaryPassword = false; OfferToSaveLoginsDefault = false; PasswordManagerEnabled = false; DisableMasterPasswordCreation = true; AutofillAddressEnabled = false; HttpsOnlyMode = "force_enabled"; AutofillCreditCardEnabled = false; DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab" DisplayMenuBar = "never"; # alternatives: "always", "never" or "default-on" NoDefaultBookmarks = true; SearchSuggestEnabled = false; PrivateBrowsingModeAvailability = if cfg.forcePrivateBrowsing then 2 else 0; FirefoxHome = { Search = true; TopSites = false; SponsoredTopSites = false; Highlights = false; Pocket = false; SponsoredPocket = false; Snippets = false; Locked = false; }; PopupBlocking = { Allow = [ "https://vault.cs.uni-paderborn.de:8200" "https://vault.prod.cs.uni-paderborn.de:8200" "https://vault.staging.cs.uni-paderborn.de:8200" "https://vault.dev.cs.uni-paderborn.de:8200" "https://tickets.cs.uni-paderborn.de" "https://tickets-dev.cs.uni-paderborn.de" ]; }; SearchBar = "unified"; # alternative: "separate" ExtensionSettings = { "*" = { installation_mode = "blocked"; blocked_install_message = "Addons have to be configured through home-manager!"; allowed_types = [ ]; }; # Bitwarden "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/{446900e4-71c2-419f-a6a7-df9c091e268b}/latest.xpi"; installation_mode = "normal_installed"; }; # Dark Reader "addon@darkreader.org" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/addon@darkreader.org/latest.xpi"; installation_mode = "normal_installed"; }; # Catppuccin Mocha Blue "{2adf0361-e6d8-4b74-b3bc-3f450e8ebb69}" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/{2adf0361-e6d8-4b74-b3bc-3f450e8ebb69}/latest.xpi"; installation_mode = "normal_installed"; }; # uBlock Origin "uBlock0@raymondhill.net" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; installation_mode = "normal_installed"; }; # LanguageTool "languagetool-webextension@languagetool.org" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/languagetool-webextension@languagetool.org/latest.xpi"; installation_mode = "normal_installed"; }; # Privacy Badger "jid1-MnnxcxisBPnSXQ@jetpack" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/jid1-MnnxcxisBPnSXQ@jetpack/latest.xpi"; installation_mode = "normal_installed"; }; # Tree Style Tab "treestyletab@piro.sakura.ne.jp" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/treestyletab@piro.sakura.ne.jp/latest.xpi"; installation_mode = "normal_installed"; }; # Windscribe "@windscribeff" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/@windscribeff/latest.xpi"; installation_mode = "normal_installed"; }; }; }; # ---- PREFERENCES ---- # Check about:config for options. #preferencesStatus = "locked"; # locks all settings profiles.default = { containersForce = true; isDefault = true; settings = { "browser.contentblocking.category" = "strict"; "extensions.pocket.enabled" = false; "extensions.screenshots.disabled" = true; "browser.topsites.contile.enabled" = false; "browser.formfill.enable" = false; "browser.search.suggest.enabled" = false; "browser.search.suggest.enabled.private" = false; "browser.urlbar.suggest.searches" = false; "browser.urlbar.showSearchSuggestionsFirst" = false; "browser.newtabpage.activity-stream.feeds.section.topstories" = false; "browser.newtabpage.activity-stream.feeds.snippets" = false; "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false; "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false; "browser.newtabpage.activity-stream.section.highlights.includeVisited" = false; "browser.newtabpage.activity-stream.showSponsored" = false; "browser.newtabpage.activity-stream.system.showSponsored" = false; "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; "extensions.autoDisableScopes" = 0; "browser.translations.neverTranslateLanguages" = "de"; "browser.translations.alwaysTranslateLanguages" = ""; "browser.warnOnQuit" = false; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "dom.security.https_only_mode" = true; "browser.privatebrowsing.autostart" = cfg.forcePrivateBrowsing; "extensions.activeThemeID" = "{2adf0361-e6d8-4b74-b3bc-3f450e8ebb69}"; "browser.sessionstore.resume_session_once" = !cfg.forcePrivateBrowsing; }; search = { force = true; default = "DuckDuckGo"; engines = { "Nix Packages" = { urls = [ { template = "https://search.nixos.org/packages"; params = [ { name = "type"; value = "packages"; } { name = "query"; value = "{searchTerms}"; } ]; } ]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ ":np" ]; }; "NixOS Wiki" = { urls = [ { template = "https://wiki.nixos.org/index.php?search={searchTerms}"; } ]; iconUpdateURL = "https://wiki.nixos.org/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":nw" ]; }; "ArchWiki" = { urls = [ { template = "https://wiki.archlinux.org/index.php?search={searchTerms}"; } ]; iconUpdateURL = "https://wiki.archlinux.org/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":aw" ]; }; "Ecosia" = { urls = [ { template = "https://www.ecosia.org/search?q={searchTerms}"; } ]; iconUpdateURL = "https://ecosia.org/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ "@eco" ]; }; "Wikipedia (de)" = { urls = [ { template = "https://de.wikipedia.org/w/index.php?search={searchTerms}"; } ]; iconUpdateURL = "https://wikipedia.org/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":wd" ]; }; "IMDb" = { urls = [ { template = "https://www.imdb.com/find/?q={searchTerms}"; } ]; iconUpdateURL = "https://imdb.com/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":f" ]; }; "YouTube" = { urls = [ { template = "https://www.youtube.com/results?search_query={searchTerms}"; } ]; iconUpdateURL = "https://youtube.com/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":y" ]; }; "dict.cc (de<->en)" = { urls = [ { template = "https://www.dict.cc/?s={searchTerms}"; } ]; iconUpdateURL = "https://dict.cc/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":d" ]; }; "MyNixOS" = { urls = [ { template = "https://mynixos.com/search?q={searchTerms}"; } ]; iconUpdateURL = "https://mynixos.com/favicon.ico"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ ":mn" ]; }; "Bing".metaData.hidden = true; "Google".metaData.hidden = true; "DuckDuckGo".metaData.alias = "@ddg"; # builtin engines only support specifying one additional alias "Wikipedia (en)".metaData.alias = ":w"; # builtin engines only support specifying one additional alias }; order = [ "DuckDuckGo" "Nix Packages" "ArchWiki" "Nix Wiki" "Ecosia" ]; }; bookmarks = [ ]; userChrome = '' /*** Remove items from image context menu ***/ /* Email Image... */ #context-sendimage, /* Set Image as Desktop Background... (and preceding separator) */ #context-sep-setbackground, #context-setDesktopBackground, /* Inspect Accessibility Properties */ #context-inspect-a11y { display: none !important; } /* Disable Firefox View */ #firefox-view-button { display: none !important; } /* Disable Tab Bar ('cause TST) */ #TabsToolbar { visibility: collapse !important; } /* Remove flexible spaces #customizableui-special-spring1 { display: none !important; } #customizableui-special-spring2 { display: none !important; } #customizableui-special-spring3 { display: none !important; } #customizableui-special-spring4 { display: none !important; } ''; }; }; }; }