Skip to content

Commit

Permalink
chore: Handle renamed options, disable firefox hw accel on nvidia
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitawootten committed Jul 6, 2024
1 parent e7f87a8 commit 711927d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 80 deletions.
112 changes: 67 additions & 45 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hostModules/personal/gnome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in {
atomix # puzzle game
];

environment.systemPackages = with pkgs; [ gnome.gnome-tweaks ];
environment.systemPackages = with pkgs; [ gnome-tweaks ];

# environment.sessionVariables.NIXOS_OZONE_WL = "1";
};
Expand Down
32 changes: 2 additions & 30 deletions hostModules/personal/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ in {
config = lib.mkIf cfg.enable {
nixpkgs.config.allowUnfree = true;

hardware.opengl = {
hardware.graphics = {
enable = true;
driSupport = true;
driSupport32Bit = true;
enable32Bit = true;
extraPackages = with pkgs; [ vaapiVdpau ];
};

Expand All @@ -39,32 +38,5 @@ in {
"nvidia.NVreg_PreserveVideoMemoryAllocations=1";

virtualisation.docker.enableNvidia = true;

# NVIDIA HW Accel, via https://github.com/Moskas/nixos-config
environment.variables = {
# Necessary to correctly enable va-api (video codec hardware
# acceleration). If this isn't set, the libvdpau backend will be
# picked, and that one doesn't work with most things, including
# Firefox.
LIBVA_DRIVER_NAME = "nvidia";
# Required to run the correct GBM backend for nvidia GPUs on wayland
GBM_BACKEND = "nvidia-drm";
# Apparently, without this nouveau may attempt to be used instead
# (despite it being blacklisted)
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
# Hardware cursors are currently broken on nvidia
WLR_NO_HARDWARE_CURSORS = "1";

# Required to use va-api it in Firefox. See
# https://github.com/elFarto/nvidia-vaapi-driver/issues/96
MOZ_DISABLE_RDD_SANDBOX = "1";
# It appears that the normal rendering mode is broken on recent
# nvidia drivers:
# https://github.com/elFarto/nvidia-vaapi-driver/issues/213#issuecomment-1585584038
NVD_BACKEND = "direct";
# Required for firefox 98+, see:
# https://github.com/elFarto/nvidia-vaapi-driver#firefox
EGL_PLATFORM = "wayland";
};
};
}
11 changes: 7 additions & 4 deletions hosts/dionysus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
enable = true;
headless = false;
suspend = true;
betaDriver = true;
};

hardware.opengl = {
hardware.graphics = {
enable = true;
driSupport32Bit = true;
enable32Bit = true;
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
};

Expand Down Expand Up @@ -70,9 +71,11 @@

programs.firefox.profiles.default.settings = {
"gfx.webrender.all" = true; # Force enable GPU acceleration
"media.ffmpeg.vaapi.enabled" = true;
"widget.dmabuf.force-enabled" = true; # Required in recent Firefoxes
# "media.ffmpeg.vaapi.enabled" = true;
# "widget.dmabuf.force-enabled" = true; # Required in recent Firefoxes
};

home.sessionVariables.MOZ_ENABLE_WAYLAND = "0";
};

programs.nix-ld.enable = true;
Expand Down

0 comments on commit 711927d

Please sign in to comment.