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;
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;
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:
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.
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
};
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 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.