feat: "bake-in" firefox env vars

This commit is contained in:
oddlama 2023-09-08 14:30:36 +02:00
parent cbdc3b7bff
commit 6af1950f53
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A

View file

@ -1,13 +1,34 @@
{
programs.firefox.enable = true;
home.sessionVariables = {
lib,
pkgs,
...
}: let
inherit (lib) concatStringsSep escapeShellArg mapAttrsToList;
env = {
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;
# To allow vaapi access for hardware acceleration
# 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";
NVD_BACKEND = "direct";
};
envStr = concatStringsSep " " (mapAttrsToList (n: v: "${n}=${escapeShellArg v}") env);
in {
programs.firefox.enable = true;
programs.firefox.package = pkgs.firefox.overrideAttrs (old: {
buildCommand =
old.buildCommand
+ ''
substituteInPlace $out/bin/firefox \
--replace "exec -a" ${escapeShellArg envStr}" exec -a"
'';
});
# TODO userChrome
# TODO settings if they can coexist with non declarative stuff
home.persistence."/state".directories = [
"Downloads"