NVIDIA: nouveau still used

I have a PC with an “NVIDIA Geforce GTX Titan X”. Apparently it uses a legacy driver, between 470 and 535 maybe.

I made this config and load it at the beginning in my configuration.nix

{ config, lib, pkgs, ...}:
{
  # Enable OpenGL
  hardware.graphics.enable = true;

  hardware.nvidia = {

    modesetting.enable = true;

    # experimental
    powerManagement.enable = true;

    # fine grained power management, only works on Turing or newer
    powerManagement.finegrained = false;

    open = false;

    nvidiaSettings = true;

    package = config.boot.kernelPackages.nvidiaPackages.legacy_535; 
  };

  environment.systemPackages = with pkgs; [
    nvtopPackages.nvidia

    #nvidia-modprobe

    nvidia-vaapi-driver
    # nvidia-system-monitor-qt

    linuxKernel.packages.linux_6_12.nvidia_x11
    linuxKernel.packages.linux_6_12.nvidia_x11_vulkan_beta
  ];
}

It is mostly based on the wiki.

But after a long build process and correcting syntax issues in that file, I still boot and my system uses nouveau.

I would totally use nouveau, the performance is fine, but kwin crashes constantly when spawning windows, making it unusable

I assume the wiki is incomplete and I need to add some kernel parameters?

I don’t think that works to install kernel modules, and these don’t point to the legacy driver like your setting for the package option.

It seems like you also forgot the essential services.xserver.videoDrivers = [ "nvidia" ]; option, as described by the manual.

After adding this, SDDM doesnt show up, the screen is black

services.xserver.videoDrivers = [ "nvidia" ];

TTY output looks different so the driver is there. I will try the 470 instead

You shouldn’t be installing those kernel modules yourself at all, the nvidia module will do that.

In addition to the kernel modules mentioned above, installing nvidia-vaapi-driver through environment.systemPackages also does nothing. That should go in hardware.graphics.extraPackages if you want it.

The most basic problem, though, is that you haven’t enabled the use of the nvidia module at all. You need to set services.xserver.videoDrivers = [ "nvidia" ];

1 Like

Thanks guys! Yes for sure that was the missing step, even though needing that is weird when not using X, and it was already enabled :thinking:

Switching to the 470 suddenly required me to accept a license, now it builds, lets see.

I will also add the vaapi package to the correct group.

On a card that old, wayland may not be an option. Last I knew, it wasn’t on mine (a GeForce GTX 970). (Though maybe kwin works around it? I remember something about that, but it wasn’t relevant to me as I want to use sway.)

Soo, with the 470 driver I get a desktop but no panel. An unknown extra display was created and primary, disabling that fixed the bug.

Nvtop shows 0% gpu usage, same when running as root. Lets see if benchmarks can change this.

Nvidia seems to work! This is the new config

{ config, lib, pkgs, ...}:
{
  # Enable OpenGL
  hardware.graphics.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia = {
    modesetting.enable = true;
    # experimental
    powerManagement.enable = true;
    # fine grained power management, only works on Turing or newer
    powerManagement.finegrained = false;
    # not supported
    open = false;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
  };

  hardware.graphics.extraPackages = with pkgs; [
    nvidia-vaapi-driver
  ];

  environment.systemPackages = with pkgs; [
    nvtopPackages.nvidia
    #nvidia-modprobe
    # nvidia-system-monitor-qt
    config.boot.kernelPackages.nvidia_x11
    config.boot.kernelPackages.nvidia_x11_vulkan_beta
  ];
}

I am not yet sure if OpenGL, Vulkan and Vaapi work.

For example Bottles Flatpak didnt start because it couldnt find an EGL something.

You don’t need this either, it’s installed by default: NixOS Search

It also doesn’t do anything unless you do a bunch of additional configuration, read the readme of that project.

I honestly doubt it even works on such an old driver.

You really ought to remove those two lines.

1 Like

Try out the normal driver, by the way, your card is listed as supported.

1 Like

Indeed, the stable driver seems to work fine! Very nice

To be clear, don’t use _beta or anything. Just don’t set the package option, and let NixOS choose the default.

Whenever the 590 driver comes out, you’ll probably want to switch to _legacy580 (since the 590 driver deprecates support for your GPU), but nixpkgs doesn’t have a special package for that yet.

1 Like

I’ve actually had another closer look. Just use this config:

{ config, lib, pkgs, ...}:
{
  # Enable OpenGL
  # Most DEs enable this already, so you likely don't
  # need this either.
  hardware.graphics.enable = true;

  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia = {
    powerManagement.enable = true;
    open = false;
  };

  environment.systemPackages = with pkgs; [
    nvtopPackages.nvidia
  ];
}

Everything else you set is either redundant or inadvisable.

Okay so until the Titan X is deprecated, I use this config

{ config, lib, pkgs, ...}:
{
  services.xserver.videoDrivers = [ "nvidia" ];

  hardware.nvidia = {
    modesetting.enable = true;
    # experimental
    powerManagement.enable = true;
    # fine grained power management, only works on Turing or newer
    powerManagement.finegrained = false;
    # GPU not supported
    open = false;
    nvidiaSettings = true;
  };
  
  # no effect without further configs
  hardware.graphics.extraPackages = with pkgs; [
    nvidia-vaapi-driver
  ];

  environment.systemPackages = with pkgs; [
    nvtopPackages.nvidia
    # nvidia-modprobe
    # nvidia-system-monitor-qt
  ];
}

I’d still recommend at least using the open driver. If you don’t trust me, then hear it from nvidia themselves (your GPU is Maxwell): Chapter 45. Open Linux Kernel Modules

Most other stuff you set should at least just be a repeat of the defaults, which isn’t harmful.

1 Like

Nice, I thought the open driver supported only very new ones? My GPU is Pascal or Maxwell, idk wasnt able to find out easily. So I understood that either of them is older than Turing and not supported by the open source driver sadly.

Nouveau caused many crashes, but I am very much in favor of an open driver even at a performance downgrade.

Thanks for the help! Will try the open one tomorrow

Maxwell or newer. Your GPU is “very new”, by some definition of “very new”.

Nope. In my defense, it’s late.

The open module developed by nvidia shouldn’t cause any performance degradation or anything. It’s the only driver actively being developed now, if anything you’ll see better performance.

Newer cards even only work with the open driver.

Nouveau is a third-party FOSS alternative, it has nothing to do with the open nvidia module.

1 Like

Where did you get Maxwell or newer? I only ever read Turing or newer, which is newer than my GPU

Ah, oops, nevermind. I was surprised by that too, I clearly read the wrong paragraph. Quoting the manual page I linked:

The open flavor of kernel modules supports Turing and later GPUs. The open kernel modules cannot support GPUs before Turing, because the open kernel modules depend on the GPU System Processor (GSP) first introduced in Turing.

1 Like

Sad sad…

Thanks for the help!

Ok, whew. You had me double checking, since I was pretty sure my own GeForce GTX 970 didn’t qualify for the open drivers.

2 Likes