grimm-nixos-laptop/common/firefox.nix

81 lines
2.6 KiB
Nix
Raw Normal View History

2024-04-10 16:51:28 +02:00
{ inputs, pkgs, config, lib, ... }:
let
2024-03-24 16:59:47 +01:00
cfg = config.grimmShared;
2024-04-10 16:51:28 +02:00
in
{
2024-03-24 16:59:47 +01:00
config = with cfg; lib.mkIf (enable && firefox.enable) {
2024-04-10 16:51:28 +02:00
environment.systemPackages = [ ]
2024-03-24 16:59:47 +01:00
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = {
package = pkgs.firefox-beta;
2024-03-24 16:59:47 +01:00
enable = true;
2024-04-10 16:51:28 +02:00
nativeMessagingHosts.packages = [ ]
2024-03-24 16:59:47 +01:00
++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ];
languagePacks = lib.optionals cfg.locale [ "de" "en-US" ];
2024-03-24 16:59:47 +01:00
policies = {
ExtensionSettings = lib.mkMerge [
(lib.mkIf cfg.firefox.disableUserPlugins {
"*".installation_mode = "blocked";
2024-04-10 16:51:28 +02:00
})
(lib.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";
})
cfg.firefox.plugins)
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) {
# password-store support
2024-03-24 16:59:47 +01:00
"passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed";
};
})
];
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;
2024-04-13 19:16:33 +02:00
Preferences = lib.mkMerge ([{
"pdfjs.enableScripting" = false;
2024-04-20 19:50:23 +02:00
"media.hardware-video-decoding.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"media.navigator.mediadatadecoder_vpx_enabled" = true;
2024-04-13 19:16:33 +02:00
}]
++ lib.optional cfg.sway.enable { "browser.tabs.inTitlebar" = 0; }
);
2024-03-24 16:59:47 +01: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";
};
disableUserPlugins = mkOption {
type = types.bool;
default = false;
description = "disables user controlled plugins";
};
};
2024-03-24 16:59:47 +01:00
}