grimm-nixos-laptop/common/firefox.nix

190 lines
6.6 KiB
Nix
Raw Normal View History

2024-05-07 23:31:41 +02:00
{
pkgs,
config,
lib,
...
}:
2024-04-10 16:51:28 +02:00
let
2024-05-11 22:55:59 +02:00
inherit (config.grimmShared)
enable
firefox
locale
sway
;
inherit (lib)
mkIf
optionals
mapAttrs
optionalAttrs
;
2024-04-10 16:51:28 +02:00
in
{
2024-05-11 22:55:59 +02:00
config = mkIf (enable && firefox.enable) {
environment.systemPackages =
[ ]
++ optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
2024-03-24 16:59:47 +01:00
2024-05-11 22:55:59 +02:00
programs.firefox = {
2025-02-22 18:09:06 +01:00
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+]
''
)
];
};
2024-05-11 22:55:59 +02:00
enable = true;
languagePacks = optionals locale [
"de"
"en-US"
];
policies = {
ExtensionSettings =
2024-12-02 10:40:53 +01:00
# (mkIf firefox.disableUserPlugins { "*".installation_mode = "blocked"; }) //
2024-11-26 19:20:10 +01:00
(
mapAttrs (guid: shortId: {
2024-12-02 10:40:53 +01:00
# explicit plugins by config
2024-11-26 19:20:10 +01:00
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed";
}) config.grimmShared.firefox.plugins
);
2024-05-11 22:55:59 +02:00
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
2024-05-07 23:31:41 +02:00
};
2024-05-11 22:55:59 +02:00
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
2025-02-24 01:32:21 +01:00
FirefoxHome = {
TopSites = true;
SponsoredTopSites = false;
Pocket = false;
Snippets = false;
Highlights = false;
Locked = true;
};
FirefoxSuggest = {
WebSuggestions = false;
SponsoredSuggestions = false;
ImproveSuggest = false;
Locked = true;
};
SearchEngines = {
2025-02-25 22:09:20 +01:00
Default = "SearXNG";
2025-02-24 01:32:21 +01:00
Remove = ["Bing" "Amazon.ca" "eBay"];
Add = [
2025-02-25 22:09:20 +01:00
{
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";
}
2025-02-24 01:32:21 +01:00
{
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";
}
];
};
2024-05-11 22:55:59 +02:00
Preferences = {
"pdfjs.enableScripting" = false;
2025-02-22 18:09:06 +01:00
"signon.rememberSignons" = false;
2024-05-11 22:55:59 +02:00
"media.hardware-video-decoding.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"media.navigator.mediadatadecoder_vpx_enabled" = true;
2025-02-22 18:09:06 +01:00
"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";
2024-05-11 22:55:59 +02:00
} // optionalAttrs sway.enable { "browser.tabs.inTitlebar" = 0; };
2024-03-24 16:59:47 +01:00
};
};
2024-05-11 22:55:59 +02:00
};
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";
};
2024-05-11 22:55:59 +02:00
disableUserPlugins = mkEnableOption "disables user controlled plugins";
};
2024-03-24 16:59:47 +01:00
}