fix(nvidia): fix flickering on sway

This commit is contained in:
Tibo De Peuter 2026-09-25 11:12:59 +02:00
parent c548501d52
commit 603659b77d
No known key found for this signature in database
GPG key ID: 9187B5FA0F4B6F6D
2 changed files with 8 additions and 14 deletions

View file

@ -40,10 +40,8 @@ let
# gsettings set $gnome_schema gtk-theme 'Dracula' # gsettings set $gnome_schema gtk-theme 'Dracula'
# https://github.com/crispyricepc/sway-nvidia/blob/2101a18698151a61266740f1297158119bf660ac/wlroots-env-nvidia.sh # https://github.com/crispyricepc/sway-nvidia/blob/2101a18698151a61266740f1297158119bf660ac/wlroots-env-nvidia.sh
# Hardware cursors not yet working on wlroots # Intel primary, NVIDIA secondary
export WLR_NO_HARDWARE_CURSORS=1 export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0
# Set wlroots renderer to Vulkan to avoid flickering
export WLR_RENDERER=vulkan
# General wayland environment variables # General wayland environment variables
export XDG_SESSION_TYPE=wayland export XDG_SESSION_TYPE=wayland
export QT_QPA_PLATFORM=wayland export QT_QPA_PLATFORM=wayland
@ -52,10 +50,8 @@ let
export MOZ_ENABLE_WAYLAND=1 export MOZ_ENABLE_WAYLAND=1
export MOZ_USE_XINPUT2=1 export MOZ_USE_XINPUT2=1
# OpenGL Variables # OpenGL Variables
export GBM_BACKEND=nvidia-drm
export __GL_GSYNC_ALLOWED=0 export __GL_GSYNC_ALLOWED=0
export __GL_VRR_ALLOWED=0 export __GL_VRR_ALLOWED=0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
# Xwayland compatibility # Xwayland compatibility
export XWAYLAND_NO_GLAMOR=1 export XWAYLAND_NO_GLAMOR=1
''; '';
@ -105,7 +101,7 @@ in {
noto-fonts noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
noto-fonts-cjk-serif noto-fonts-cjk-serif
noto-fonts-emoji noto-fonts-color-emoji
]; ];
hardware.graphics.enable = true; hardware.graphics.enable = true;
@ -115,9 +111,8 @@ in {
dbus.enable = true; dbus.enable = true;
displayManager.ly.enable = true; displayManager.ly.enable = true;
gnome.gnome-keyring.enable = true; gnome.gnome-keyring.enable = true;
power-profiles-daemon.enable = true; # xserver.videoDrivers = [ "nouveau" ];
xserver.videoDrivers = [ "nouveau" ]; xserver.videoDrivers = [ "nvidia" ];
# xserver.videoDrivers = [ "nvidia" ];
}; };
xdg.portal = { xdg.portal = {

View file

@ -25,6 +25,8 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot.kernelParams = [ "nvidia_drm.fbdev=1" ];
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
@ -44,7 +46,7 @@ in {
open = false; open = false;
branch = "stable"; branch = "stable";
# To override the default package set by the branch: # To override the default package set by the branch:
#package = config.boot.kernelPackages.nvidiaPackages.stable; package = config.boot.kernelPackages.nvidiaPackages.latest;
# Modesetting is required. # Modesetting is required.
modesetting.enable = true; modesetting.enable = true;
nvidiaSettings = cfg.gui-settings; nvidiaSettings = cfg.gui-settings;
@ -53,9 +55,6 @@ in {
finegrained = do-offloading; finegrained = do-offloading;
}; };
# Avoid flickering
forceFullCompositionPipeline = true;
prime = lib.mkMerge [ prime = lib.mkMerge [
(lib.mkIf do-offloading { (lib.mkIf do-offloading {
offload = { offload = {