nixos-config/user/firefox.nix

76 lines
2.6 KiB
Nix
Raw Normal View History

2022-10-18 22:41:40 -03:00
{ config, pkgs, lib, font, ... }:
2023-01-22 00:10:08 -03:00
let inherit (import ./variables.nix) desktop browser;
2022-10-18 22:41:40 -03:00
in {
config = {
programs.firefox = {
enable = true;
# esr enables you to install unsigned extensions
package = pkgs.wrapFirefox pkgs.firefox-esr-unwrapped {
nixExtensions = with pkgs.nur.repos.rycee.firefox-addons;
let
extensions_name_src = {
darkreader = darkreader.src;
ublock-origin = ublock-origin.src;
tree-style-tab = tree-style-tab.src;
sponsorblock = sponsorblock.src;
duckduckgo-privacy-essentials = duckduckgo-privacy-essentials.src;
};
make_extension = name: src:
((pkgs.fetchFirefoxAddon { inherit name src; }));
2023-01-22 18:12:04 -03:00
in
lib.mapAttrsToList make_extension extensions_name_src;
};
2022-10-18 22:41:40 -03:00
profiles = {
main = {
isDefault = true;
settings = {
2022-11-07 11:24:40 -03:00
"devtools.theme" = "auto";
2022-10-18 22:41:40 -03:00
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
2022-11-07 11:24:40 -03:00
"browser.tabs.inTitlebar" = if desktop == "sway" then 0 else 1;
2022-10-18 22:41:40 -03:00
2023-01-11 21:00:30 -03:00
# disable media RDD because it's buggy and crashes the gpu
"media.rdd-ffmpeg.enabled" = false;
"media.rdd-ffvpx.enabled" = false;
"media.rdd-opus.enabled" = false;
"media.rdd-process.enabled" = false;
"media.rdd-retryonfailure.enabled" = false;
"media.rdd-theora.enabled" = false;
"media.rdd-vorbis.enabled" = false;
"media.rdd-vpx.enabled" = false;
"media.rdd-wav.enabled" = false;
2022-11-07 11:24:40 -03:00
"media.av1.enabled" = true;
2023-01-11 21:00:30 -03:00
"media.ffmpeg.vaapi-drm-display.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.ffvpx.enabled" = false;
2022-10-18 22:41:40 -03:00
"gfx.webrender.all" = true;
};
2022-11-07 11:24:40 -03:00
userChrome = lib.mkIf (desktop == "sway") ''
2022-10-22 23:54:02 -03:00
#titlebar { display: none !important; }
2022-10-18 22:41:40 -03:00
'';
};
};
};
2023-01-22 00:10:08 -03:00
systemd.user.services = lib.mkIf (browser == "firefox") {
2022-12-21 21:01:16 -03:00
firefox = {
Unit = {
Description = "Firefox Web client";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
2022-12-24 10:27:07 -03:00
ExecStartPre = "/usr/bin/env sleep 10s";
2022-12-21 21:01:16 -03:00
ExecStart = "${pkgs.firefox}/bin/firefox";
Restart = "on-failure";
};
Install = { WantedBy = [ "sway-session.target" ]; };
};
};
2023-01-11 21:00:30 -03:00
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
MOZ_DISABLE_RDD_SANDBOX = "1";
};
2022-10-18 22:41:40 -03:00
};
}