nixos-config/home-manager/modules/firefox/default.nix

129 lines
3.8 KiB
Nix

{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.eboskma.programs.firefox;
profileSettings = {
"app.shield.optoutstudies.enabled" = false;
"beacon.enabled" = false;
"breakpad.reportURL" = "";
"browser.chrome.guess_favicon" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"browser.crashReports.unsubmittedCheck.enabled" = false;
"browser.shell.checkDefaultBrowser" = false;
"browser.tabs.crashReporting.sendReport" = false;
"browser.translations.enable" = false;
"browser.urlbar.trimURLs" = false;
"devtools.theme" = "dark";
"experiments.activeExperiment" = false;
"experiments.enabled" = false;
"experiments.manifest.uri" = "";
"experiments.supported" = false;
"extensions.quarantinedDomains.enabled" = false;
"gfx.webrender.all" = true;
"image.avif.enabled" = true;
"image.webp.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"network.allow-experimens" = false;
"network.http.referer.spoofSource" = true;
"privacy.query_stripping" = true;
"privacy.webrtc.allowSilencingNotifications" = true;
"privacy.webrtc.legacyGlobalIndicator" = false;
"security.tls.enable_0rtt_data" = false;
"services.sync.prefs.sync.browser.newtabpage.activity-stream.showSponsoredTopSite" = false;
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.cachedClientID" = "";
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.prompted" = 2;
"toolkit.telemetry.rejected" = true;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"toolkit.telemetry.server" = "";
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.unifiedIsOptIn" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"ui.key.menuAccessKeyFocuses" = false;
"widget.content.allow-gtk-dark-theme" = true;
};
nonDefaultDesktop = pkgs.makeDesktopItem {
name = "firefox-" + (if cfg.work then "private" else "horus");
desktopName = "Firefox (" + (if cfg.work then "Personal" else "Horus") + ")";
exec = "firefox -P " + (if cfg.work then "private" else "horus") + " %u";
icon = "firefox";
categories = [
"GNOME"
"GTK"
"Network"
"WebBrowser"
];
mimeTypes = [
"text/html"
"text/xml"
"application/xhtml+xml"
"application/xml"
"application/rss+xml"
"application/rdf+xml"
"image/gif"
"image/jpeg"
"image/png"
"x-scheme-handler/http"
"x-scheme-handler/https"
"x-scheme-handler/ftp"
"x-scheme-handler/chrome"
"video/webm"
"application/x-xpinstall"
];
startupNotify = true;
extraConfig = {
"X-MultipleArgs" = "false";
};
};
in
{
options.eboskma.programs.firefox = {
enable = mkEnableOption "enable firefox";
work = mkOption {
description = "whether this is a work config";
type = types.bool;
default = false;
};
};
config = mkIf cfg.enable {
programs.firefox = {
enable = true;
package = pkgs.wrapFirefox (pkgs.firefox-unwrapped.override {
pipewireSupport = true;
ffmpegSupport = true;
}) { };
profiles = {
private = {
id = 0;
isDefault = !cfg.work;
settings = profileSettings;
};
horus = {
id = 1;
isDefault = cfg.work;
settings = profileSettings;
};
};
};
home.packages = [ nonDefaultDesktop ];
};
}