First time poster!! I’ve been running nixos for 1y ish and I’m so proud and happy of the current state of my machine!
Nonetheless I’ve been battling with nvidia drivers recently, I’m currently “just“ experiencing screen flickering from time to time. It’s a big win compared to previous generations in which I was not even able to get into graphical session but still a headache..
May somebody point me towards the issue of the flickering XOR give me tips for maybe improving my config? Thanks ^^
Machine hardware:
Asus Rog Strix G513QR with a rtx 3070 and ryzen 7 5800 H
Machine software:
Kernel: 6.12.74
Nvidia driver Version: 580.119.02
Nixos 25.11
Possibly useful snippets from my configuration.nix:
boot.initrd.kernelModules = [
“nvidia”
“nvidia_modeset”
“nvidia_uvm”
“nvidia_drm”
];
boot.kernelParams = [
“nvidia_drm.modeset=1”
# “nvidia_drm.fbdev=1”
# “pcie_aspm=off”
“zswap.enabled=1”
# “nvidia.NVreg_DynamicPowerManagement=0x02”
“iommu=pt”
];
boot.kernelPackages = pkgs.linuxPackages;
My nvidia.nix module (imported at the configuration.nix):
{
config,
pkgs,
lib,
…
}:
{
services.xserver = {
enable = true;
videoDrivers = [
“amdgpu”
“nvidia”
];
};
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
powerManagement = {
enable = false;
finegrained = false;
};
open = true;
nvidiaSettings = true;
prime = {
sync.enable = true;
amdgpuBusId = "PCI:1:0:0";
nvidiaBusId = "PCI:5:0:0";
};
};
hardware.nvidia-container-toolkit.enable = true;
hardware.opengl.enable = true;
specialisation.on-the-go.configuration = {
system.nixos.tags = [ “on-the-go” ];
hardware.nvidia.prime = {
offload = {
enable = lib.mkForce true;
enableOffloadCmd = lib.mkForce true;
};
sync.enable = lib.mkForce false;
};
};
}
lshw -c display (as the wiki says) gives me this:
*-display
description: amdgpudrmfb
product: nvidia-drmdrmfb
physical id: 0
bus info: pci@0000:01:00.0
logical name: /dev/fb1
logical name: /dev/fb0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list rom fb
configuration: depth=32 driver=nvidia latency=0 mode=3840x2160 resolution=3840,2160 visual=truecolor xres=3840 yres=2160
resources: iomemory:fc0-fbf iomemory:fe0-fdf irq:44 memory:fb000000-fbffffff memory:fc00000000-fdffffffff memory:fe00000000-fe01ffffff ioport:f000(size=128) memory:fc000000-fc07ffff
*-display
product: amdgpudrmfb
physical id: 0
bus info: pci@0000:05:00.0
logical name: /dev/fb0
version: c5
width: 64 bits
clock: 33MHz
capabilities: pm pciexpress msi msix bus_master cap_list fb
configuration: depth=32 driver=amdgpu latency=0 resolution=1920,1080
resources: iomemory:fe0-fdf iomemory:fe0-fdf irq:56 memory:fe10000000-fe1fffffff memory:fe20000000-fe201fffff ioport:d000(size=256) memory:fc500000-fc57ffff
Notice that in my nvidia module I have PCI:5:0:0 for nvidia and PCI:1:0:0 for amd. They’re reversed but swear it’s the only way I’ve managed xrandr to show both amd and nvidia in –listproviders.
Providers: number : 2
Provider 0: id: 0x54 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 2 associated providers: 1 name:AMD Radeon Graphics @ pci:0000:05:00.0
Provider 1: id: 0x218 cap: 0x2, Sink Output crtcs: 4 outputs: 2 associated providers: 1 name:NVIDIA-G0
Thanks for reading!