Use nvidia 410 drivers on NixOS

I’m trying to use NixOS (18.09 or 19.03pre) for CUDA development, and need an nvidia driver newer than 390. Yet when I install nvidia, even though the nix expression clearly says that x64 platforms get the 410 version, my system (which is 64 bit) stubbornly installs version 390. What am I doing wrong? How do I customize this to get some other version, such as 396 or 410?

    Thanks,

              Henry

Hi, do you mind sharing your configuration.nix? It will help us figure out and reproduce the issue.

Its exactly the config you get when you do nixos-generate-config and add “nvidia” to the xorg.videoDrivers list. I’ll try again, see if the problem still exists with the current unstable installer, and paste the config, later today.

         Thanks!

FWIW the 18.09 branch has NOT been updated to 410, only unstable:

https://github.com/NixOS/nixpkgs/blob/release-18.09/pkgs/os-specific/linux/nvidia-x11/default.nix

vs

https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/nvidia-x11/default.nix


Your original post says you tried both, but perhaps there was simply a bogon somewhere and you were only on 18.09, by chance? Just a thought.

1 Like

Seems likely – which version do you get if you install using the 19.03pre installer? Alternatively, is doing nix-channel --add https://nixos.org/channels/nixos-unstalbe nixos and doing a nixos-rebuild switch --upgrade enough? How do I check which version of nixpkgs I’m using, as I agree that using the wrong version of nixpkgs seems the most likely cause…

use

nix-channel --list

as sudo, to show all installed channels.

nixos-version also outputs the current system nixos release.

Or cat /etc/os-release

For OpenCL it’s also required to set hardware.opengl.extraPackages accordingly.

IIRC 410 is relatively new on master; I find it likely that it wasn’t in nixos-unstable channel around a week ago.

Thanks! I think that was the problem. One related thing – is there a way to sub in a new sha256/URL and use a different version? I feel like overlays might be the answer I am looking for, but I’m hoping someone has a pointer to an example used on some other package…

Thanks for your help!!! The problem was exactly that the channel had not updated yet.

I’d still love to know if one can pick a particular nvidia version by sha, and if so how to do that, but that’s a separate question…

You can’t really easily do that, except for the branches we have there (304 and 340 ATM).

Thanks! Good to know…

did you ever figure out how to pick a particular nvidia driver? I’m having the same issue and don’t know how to switch to the newer nvidia driver so I can do CUDA development.

Assuming you setup xserver.videoDrivers correctly, you can try one of the solutions in the following: nixos: hardware.nvidia.package option for selecting nvidia package by FRidh · Pull Request #49703 · NixOS/nixpkgs · GitHub or https://github.com/NixOS/nixpkgs/issues/51768. Though for the unstable branch, it should’ve already reached a good driver version.

1 Like

Thanks, that was exactly what I needed! I’m still not super comfortable with the nix language syntax, so it took some fiddling before I could import the unstable channel properly.