Hello everyone,
I’m trying to configure my Nvidia GPU (RTX 3050) to be the primary GPU on NixOS (unstable), running the niri
Wayland compositor but I keep getting the same error
The Problem:
Despite my configurations that I follow from Nvidia - NixOS Wiki, nvidia-smi
consistently shows Disp.A: Off
for the Nvidia GPU, and glxinfo | grep "OpenGL renderer string"
reports the Intel GPU as the renderer.
The kernel log (dmesg
) consistently shows the following error for the Nvidia GPU:
[drm] Cannot find any crtc or sizes
System Configuration (summary):
- NixOS: (unstable)
- Dedicated GPU: NVIDIA GeForce RTX 3050 (Driver: 570.144, CUDA: 12.8)
- Integrated GPU: Intel (RPL-S)
- Wayland Compositor:
niri
- Relevant Kernel Parameters:
nvidia-drm.modeset=1
is active.
Snippets from configuration.nix
:
# hardware.nvidia
hardware.nvidia.modesetting.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
hardware.nvidia.prime = {
// I've tried both 'sync.enable = true;' and 'reverseSync.enable = true;'
// Currently using:
sync.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
// Niri session setup (to define WLR_DRM_DEVICES)
services.displayManager.sessionPackages = [
(pkgs.stdenv.mkDerivation {
name = "niri-session-with-nvidia";
buildCommand = ''
mkdir -p $out/share/wayland-sessions
cat > $out/share/wayland-sessions/niri.desktop <<EOF
[Desktop Entry]
Name=Niri (Nvidia Primary)
Comment=Niri Wayland Compositor (Attempting Nvidia Primary)
Exec=env WLR_DRM_DEVICES="/dev/dri/by-path/pci-0000:01:00.0-card" ${pkgs.dbus}/bin/dbus-run-session -- ${pkgs.niri}/bin/niri
Type=Application
DesktopNames=niri
EOF
'';
passthru.providedSessions = [ "niri" ];
})
];
// services.xserver.enable = true; // For XWayland support
What I've tried so far:
- Ensuring nvidia-drm.modeset=1 is set.
- Setting WLR_DRM_DEVICES for the niri session to point to the Nvidia card.
- Toggling between hardware.nvidia.prime.sync.enable = true; and hardware.nvidia.prime.reverseSync.enable = true;