189 lines
6.6 KiB
Nix
189 lines
6.6 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
inherit (config.grimmShared)
|
|
enable
|
|
firefox
|
|
locale
|
|
sway
|
|
;
|
|
inherit (lib)
|
|
mkIf
|
|
optionals
|
|
mapAttrs
|
|
optionalAttrs
|
|
;
|
|
in
|
|
{
|
|
config = mkIf (enable && firefox.enable) {
|
|
environment.systemPackages =
|
|
[ ]
|
|
++ optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
|
|
|
|
programs.firefox = {
|
|
package = pkgs.firefox.override {
|
|
extraPrefsFiles = [
|
|
"${pkgs.arkenfox-userjs}/user.cfg"
|
|
|
|
(pkgs.writeText "arkenfox-userjs-overrides.cfg" # javascript
|
|
''
|
|
/// arkenfox user.js overrides.
|
|
// We want session restore to work, for that we need to save history:
|
|
// https://github.com/arkenfox/user.js/issues/1080#issue-774750296
|
|
lockPref("privacy.clearOnShutdown.history", false);
|
|
lockPref("privacy.clearOnShutdown_v2.historyFormDataAndDownloads", false);
|
|
lockPref("privacy.clearOnShutdown.offlineApps", false); // Site Data
|
|
lockPref("privacy.clearOnShutdown_v2.cookiesAndStorage", false); // Cookies, Site Data, Active Logins [FF128+]
|
|
''
|
|
)
|
|
];
|
|
};
|
|
enable = true;
|
|
languagePacks = optionals locale [
|
|
"de"
|
|
"en-US"
|
|
];
|
|
policies = {
|
|
ExtensionSettings =
|
|
# (mkIf firefox.disableUserPlugins { "*".installation_mode = "blocked"; }) //
|
|
(
|
|
mapAttrs (guid: shortId: {
|
|
# explicit plugins by config
|
|
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
}) config.grimmShared.firefox.plugins
|
|
);
|
|
DisableTelemetry = true;
|
|
DisableFirefoxStudies = true;
|
|
EnableTrackingProtection = {
|
|
Value = true;
|
|
Locked = true;
|
|
Cryptomining = true;
|
|
Fingerprinting = true;
|
|
};
|
|
DisablePocket = true;
|
|
DisableFirefoxAccounts = true;
|
|
DisableAccounts = true;
|
|
DisableFirefoxScreenshots = true;
|
|
OverrideFirstRunPage = "";
|
|
OverridePostUpdatePage = "";
|
|
DontCheckDefaultBrowser = true;
|
|
|
|
FirefoxHome = {
|
|
TopSites = true;
|
|
SponsoredTopSites = false;
|
|
|
|
Pocket = false;
|
|
Snippets = false;
|
|
Highlights = false;
|
|
Locked = true;
|
|
};
|
|
|
|
FirefoxSuggest = {
|
|
WebSuggestions = false;
|
|
SponsoredSuggestions = false;
|
|
ImproveSuggest = false;
|
|
Locked = true;
|
|
};
|
|
|
|
SearchEngines = {
|
|
Default = "SearXNG";
|
|
Remove = ["Bing" "Amazon.ca" "eBay"];
|
|
Add = [
|
|
{
|
|
Name = "SearXNG";
|
|
URLTemplate = "http://search.grimmauld.de/search?q={searchTerms}&safesearch=1&categories=general";
|
|
IconURL = "https://raw.githubusercontent.com/searxng/searxng/refs/heads/master/searx/static/themes/simple/img/favicon.svg";
|
|
Alias = "searx";
|
|
}
|
|
{
|
|
Name = "Nix Package Search";
|
|
URLTemplate = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}";
|
|
IconURL = "https://github.com/NixOS/nixos-artwork/raw/refs/heads/master/logo/nix-snowflake-white.svg";
|
|
Alias = "np";
|
|
}
|
|
{
|
|
Name = "NixOS Option Search";
|
|
URLTemplate = "https://search.nixos.org/options?channel=unstable&query={searchTerms}";
|
|
IconURL = "https://github.com/NixOS/nixos-artwork/raw/refs/heads/master/logo/nix-snowflake-white.svg";
|
|
Alias = "no";
|
|
}
|
|
{
|
|
Name = "NixOS Wiki";
|
|
URLTemplate = "https://nixos.wiki/index.php?search={searchTerms}";
|
|
IconURL = "https://github.com/NixOS/nixos-artwork/raw/refs/heads/master/logo/nix-snowflake-white.svg";
|
|
Alias = "nw";
|
|
}
|
|
{
|
|
Name = "Home Manager Option Search";
|
|
URLTemplate = "https://mipmip.github.io/home-manager-option-search?query={searchTerms}";
|
|
IconURL = "https://github.com/NixOS/nixos-artwork/raw/refs/heads/master/logo/nix-snowflake-white.svg";
|
|
Alias = "hm";
|
|
}
|
|
];
|
|
};
|
|
|
|
Preferences = {
|
|
"pdfjs.enableScripting" = false;
|
|
"signon.rememberSignons" = false;
|
|
|
|
"media.hardware-video-decoding.enabled" = true;
|
|
"media.ffmpeg.vaapi.enabled" = true;
|
|
"media.rdd-ffmpeg.enabled" = true;
|
|
"media.navigator.mediadatadecoder_vpx_enabled" = true;
|
|
"media.eme.enabled" = true;
|
|
# "media.peerconnection.enabled" = false;
|
|
|
|
"browser.startup.homepage" = "about:home";
|
|
"browser.startup.page" = 1;
|
|
"browser.newtabpage.enabled" = true;
|
|
"browser.toolbars.bookmarks.visibility" = "newtab";
|
|
"browser.download.useDownloadDir" = true;
|
|
|
|
# "general.useragent.override" = "";
|
|
# "permissions.memory_only" = true;
|
|
"privacy.resistFingerprinting" = true;
|
|
"privacy.resistFingerprinting.block_mozAddonManager" = true;
|
|
"network.http.referer.XOriginPolicy" = 1;
|
|
"network.http.referer.XOriginTrimmingPolicy" = 1;
|
|
"network.http.sendRefererHeader" = 0;
|
|
|
|
"network.proxy.socks" = builtins.head (builtins.split ":" config.services.tor.torsocks.server);
|
|
"network.proxy.socks_port" = lib.last (builtins.split ":" config.services.tor.torsocks.server);
|
|
"network.connectivity-service.DNSv4.domain" = "127.0.0.1";
|
|
"network.connectivity-service.DNSv6.domain" = "::1";
|
|
"network.dns.localDomains" = "::1";
|
|
"network.dns.forceResolve" = true;
|
|
|
|
"extensions.formautofill.addresses.enabled" = false;
|
|
"extensions.formautofill.creditCards.enabled" = false;
|
|
|
|
"permissions.default.geo" = 2;
|
|
"permissions.default.xr" = 2;
|
|
"privacy.fingerprintingProtection" = true;
|
|
"privacy.globalprivacycontrol.enabled" = true;
|
|
"signon.firefoxRelay.feature" = "disabled";
|
|
"browser.display.use_document_fonts" = 0;
|
|
|
|
# "network.dns.DNS_HTTPS.domain" = "::1";
|
|
} // optionalAttrs sway.enable { "browser.tabs.inTitlebar" = 0; };
|
|
};
|
|
};
|
|
};
|
|
|
|
options.grimmShared.firefox = with lib; {
|
|
enable = mkEnableOption "grimm-firefox";
|
|
|
|
plugins = mkOption {
|
|
type = types.attrsOf types.str;
|
|
default = { };
|
|
description = "set of plugins to install. Format: guid = short-id";
|
|
};
|
|
|
|
disableUserPlugins = mkEnableOption "disables user controlled plugins";
|
|
};
|
|
}
|