fix: don't globally enable firefox env

This commit is contained in:
Patrick 2024-10-10 19:12:47 +02:00
parent bfd2e09e5a
commit becee17cab
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F

View file

@ -1,16 +1,31 @@
{ { lib, pkgs, ... }:
home = { let
sessionVariables = { inherit (lib) concatStringsSep escapeShellArg mapAttrsToList;
# Firefox touch support env = {
MOZ_USE_XINPUT2 = 1;
# Firefox Hardware render
MOZ_WEBRENDER = 1; MOZ_WEBRENDER = 1;
# For a better scrolling implementation and touch support.
# Be sure to also disable "Use smooth scrolling" in about:preferences
MOZ_USE_XINPUT2 = 1;
# Required for hardware video decoding.
# See https://github.com/elFarto/nvidia-vaapi-driver?tab=readme-ov-file#firefox
MOZ_DISABLE_RDD_SANDBOX = 1;
LIBVA_DRIVER_NAME = "nvidia"; LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct"; NVD_BACKEND = "direct";
MOZ_DISABLE_RDD_SANDBOX = 1;
}; };
envStr = concatStringsSep " " (mapAttrsToList (n: v: "${n}=${escapeShellArg v}") env);
in
{
programs.firefox = {
enable = true;
package = pkgs.firefox.overrideAttrs (old: {
buildCommand =
old.buildCommand
+ ''
substituteInPlace $out/bin/firefox \
--replace "exec -a" ${escapeShellArg envStr}" exec -a"
'';
});
}; };
programs.firefox.enable = true;
home.persistence."/state".directories = [ home.persistence."/state".directories = [
".cache/mozilla" ".cache/mozilla"
".mozilla" ".mozilla"