Nvidia drivers not working and nvidia-smi not installed

I have been using NixOS for about a year now and in that time I have not found any application to be able to use my RTX 2080 SUPER. My config (I am using a flake) looks like:

{ config, lib, pkgs, ... }:

{
  # See https://nixos.wiki/wiki/Nvidia
  services.xserver.videoDrivers = [
    "nvidia" # https://github.com/NixOS/nixpkgs/issues/80936#issuecomment-1003784682
  ];

  hardware = {
    opengl = {
      enable = true;
      driSupport = true;
      driSupport32Bit = true;
    };

    nvidia = {
      modesetting.enable = true;
      powerManagement = {
        enable = false;
        finegrained = false;
      };
      open = false;
      nvidiaSettings = true;
      package = config.boot.kernelPackages.nvidiaPackages.stable;
    };
  };
}

I have tried with open set to true and false, I have tried nouveau, I have tried all sorts of different options for hardware.nvidia.package, and I have read the relevant wiki page several times back to front. It is my understanding that hardware.nvidia.nvidiaSettings = true should give me access to nvidia-smi to verify whether the GPU is being used at all, but when I type nvidia-smi into my terminal I am told that this command is not found. I have had problems with using GPU acceleration on Blender in the past, Beyond All Reason (an open source video game) breaks 10 fps if I am lucky, and davinci-resolve cannot open because it cannot initialize OpenGL. This all points to the GPU not even operating at all (which begs the question of why it is able to output the video signal in the first place).

Please, if anybody can see if I have made some silly error I would be immensely grateful.

Have you allowed Unfree repos and ensured the flake is picking that up? Also is this a laptop or dedicated card in a desktop?

I have allowed unfree by doing nixpkgs.config.allowUnfree = true, not sure what would be required to ensure that the flake is picking that up—everything else in that file seems to be working, and the system builds. It is a dedicated card in a desktop.

I have done some more investigation, nvtop is suggesting that my AMD CPU is providing the graphics, and doing sudo lshw -c display yields:

  *-display                 
       description: nouveaudrmfb
       product: nouveaudrmfb
       physical id: 0
       bus info: pci@0000:01:00.0
       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=nouveau latency=0 mode=1920x1080 resolution=2560,1080 visual=truecolor xres=1920 yres=1080
       resources: iomemory:fc0-fbf iomemory:fc0-fbf irq:84 memory:fb000000-fbffffff memory:fcc0000000-fccfffffff memory:fcd0000000-fcd1ffffff ioport:f000(size=128) memory:fc000000-fc07ffff
  *-display
       physical id: 0
       bus info: pci@0000:0b:00.0
       version: ca
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi msix bus_master cap_list
       configuration: driver=amdgpu latency=0
       resources: iomemory:fc0-fbf iomemory:fc0-fbf irq:58 memory:fce0000000-fcefffffff memory:fcf0000000-fcf01fffff ioport:e000(size=256) memory:fcb00000-fcb7ffff

This seems to indicate that it is using nouveau for the GPU, even though nouveau is not mentioned anywhere in my config. I will try moving all of the driver configuration to a file that I know is definitely doing stuff in my flake to see if that changes anything.

Oh, I am stupid lol. I think that your suspicion that the flake was not pulling that file in is correct—will know more after reboot. Thank you very much

ITS WORKING!!! Thank you very much.

Awesome, glad you got it working! I am still pretty new to NixOS so I am glad I was able to look in the right spot!

2 Likes