Laptop Graphics card not detected by nixos-generate-config

I am trying to get an Nvidia 1050ti laptop graphics card working.

After installing or trying rebuild the hardware-configuration.nix file with nixos-generate-config. It seems that my graphics card is not detected at all.

lspci | grep VGA does not return any results.

The graphics card is listed in my bios menu.

When trying to install the drivers following the instructions in the manual, listed below. I end up forced directly to a tty instead of the normal login greeter.
services.xserver.videoDrivers = [ “nvidia” ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;

Link to Laptop in question: https://www.amazon.com/gp/product/B07BPB158F
Link to my config repo (sorry its a mess): https://github.com/Iron-Shark/Technonomicon

Try blacklisting the NVIDIA open source driver nouveau by adding it to boot.blacklistedKernelModules

I did as suggested but still got kicked to the TTY on login.

Current config look like this:
#Graphics Drivers
services.xserver.videoDrivers = [ “nvidia” ];
boot.blacklistedKernelModules = [ “nouveau” ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;

Two more things you can try, one at a time:

  • Blacklist the nvidiafb kernel module.
  • Use the unstable nvidia package.

Tried making the changes you suggested, but I couldn’t find the nvidia unstable package when I searched the nixpkgs website list. Could you please be more specific?

Adding this just to make sure I didn’t mess something up when adding the second blacklist item.
services.xserver.videoDrivers = [ “nvidia” ];
boot.blacklistedKernelModules = [ “nouveau” “nvidiafb” ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;

You have a dGPU and an iGPU in there, consider following the instructions here: Nvidia - NixOS Wiki

Most of the time when I see someone having problems with Nvidia on a laptop optimus fixes it.

Sorry, I should have said “beta” package. I think it’s:

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;

When I first got my hybrid laptop I also had to use a newer kernel because the default kernel did not support by iGPU (some Radeon model). It looks like the latest kernel on NixOS 22.05 is linux 5.10:

boot.kernelPackages = pkgs.linuxKernel.packages.linux_5_10;

I think that’s unlikely to be the problem, that laptop is 4 years old.

Thank you both for your help! I got it working with the prime setting. I had seen those while skimming through the wiki, but misunderstood what it was referring to. Configuration that got it working

  #Graphics Drivers
  hardware.nvidia.modesetting.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia.optimus_prime = {
    enable = true;
    nvidiaBusId = "PCI:01:00:0";   # Found with lspci | grep VGA
    intelBusId = "PCI:00:02:0";   # Found with lspci | grep VGA
  };

One note is that now on build I am getting some “scary looking” (as a novice) errors about the option naming, but when I tried to change the name to what the errors suggested it refused to build. Not sure what to do about it, and the current set up works fine. So overall I am not too worried. Attaching a copy of the error below.

Hope you both enjoy your weekend.

1 Like

That just means the option was renamed. It’s a deprecation warning, to tell you your config may not work anymore in the near future (rather than breaking it with no warning).

I’m not sure what the exact policy is, but I would expect that rhe old name will be removed entirely when the next NixOS version (22.11) is released. Given how soon that is (the 11 means end of November), I would really recommend fixing this sooner rather than later:

  #Graphics Drivers
  hardware.nvidia.modesetting.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia.prime = {
    sync.enable = true;
    nvidiaBusId = "PCI:01:00:0";   # Found with lspci | grep VGA
    intelBusId = "PCI:00:02:0";   # Found with lspci | grep VGA
  };

Looks like this was changed along with the addition of hardware.nvidia.prime.offload.enable, in nvidia: prime render offload by eadwu · Pull Request #66601 · NixOS/nixpkgs · GitHub.

Using that would allow you to use your integrated GPU for day-to-day things, and switch on the nvidia GPU for specific, heavier applications (like games), which in turn would make your battery thank you :wink: If you’re feeling up to it, you could experiment with that. Or just keep the sync setting since it’s working.

Either way, guess the wiki is outdated, need to get to updating that. Would be nice if someone who knows about offload stuff could actually write something on it.

Thank you for the advice! I update the config with the new naming conventions and it still seems to be working.
New Config

  hardware.nvidia.modesetting.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia.prime.sync.enable = true;
  hardware.nvidia.prime = {
    nvidiaBusId = "PCI:01:00:0";  # Found with lspci | grep VGA
    intelBusId = "PCI:00:02:0";  # Found with lspci | grep VGA
  };

I considered the offload, but since I currently use this laptop exclusively as a desktop. I’m not worried about the battery, and even better. Offloading all the graphics work to the GPU seems to reduce how often the CPU cooler turns on. A very good thing for me since it does it’s best to impersonate a jet turbine.

1 Like